3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $line = '"1212","$ 507.74","$ 0.00","$ 2,954.16","Kč 9,647.00","","TDR 697","","Kč 23,737.00","","","","","Kč 457.00","","","","","Kč 29,959.00","","","","","$ 104.00","","3232"'; $line = explode('","', $line); $line[0] = substr(trim($line[0], "\t\n\r"), 1); $line[count($line)-1] = substr(rtrim($line[count($line)-1], "\t\n\r"), 0, count($line)-1); $lastItem = rtrim($line[count($line)-1], "\t\n\r"); echo $lastItem.PHP_EOL; echo strlen($lastItem).PHP_EOL; echo substr($lastItem, 0, strlen($lastItem)).PHP_EOL; echo substr($lastItem, 0, strlen($lastItem)-1).PHP_EOL;
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.1.0
3232" 5 3232" 3232
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KE4eO on line 9 3232"PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KE4eO on line 10 5PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KE4eO on line 11 3232"PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KE4eO on line 12 3232PHP_EOL