PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $text = 'it is apparent why many are in the favour of the above stance. Another argument'; $offset_arr = [0, 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 ? $offset-1 : 0, $offset ? $limit : $limit-1); } var_dump($substr);
Show:  
Copy Clear