3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function trimdata($str, $start = 0, $len = 255, $sep = '|') { if($start == 0 && strlen($str) <= $len) return $str; if(strlen($str) - $start <= $len) return substr($str, $start, $len); if($start >= 0) { $str = substr($str, $start, $len + 1); //In-case the last record is complete $pos = strrpos($str, $sep, -1); $str = substr($str, $start, $pos); } else { } } $str = "0|1|2|3|4|5|6|7|8|9|0" var_dump($ret = trimdata($str, 0, 10), strlen($ret));
Output for 5.4.0 - 5.4.22
Parse error: syntax error, unexpected 'var_dump' (T_STRING) in /in/M6KXI on line 15
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING in /in/M6KXI on line 15
Process exited with code 255.