Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $text = 'it is apparent why many are in the favour of the above stance. Another argument'; $offset_arr = [1, 7, 25, 36, 56]; $substr=[]; $offset_count=0; foreach($offset_arr as $i => $offset) { $limit = ($offset_arr[$i+1] ?? strlen($text)+2) - $offset; $substr[] = substr($text, $offset-1, $limit); } var_dump($substr);
Copy Clear