3v4l.org

run code in 300+ PHP versions simultaneously
<?php function endswith($string, $test) { $strlen = strlen($string); $testlen = strlen($test); if ($testlen > $strlen) return false; return substr_compare($string, $test, -$testlen) === 0; } if(false == endswith('http://localhost/events/10','/events/')){ echo 'true'; } else{ echo 'false'; } $testlen = strlen('/bob/'); if(false == (substr_compare('http://localhost/events/10','/events/',-$testlen)===0)){ echo 'true'; } else{ echo 'false'; } $url = 'http://localhost/events/10'; //$eventid = intval(strpos($url,'/events/').); $matches = array(); preg_match ('(\d)+',$url,$matches); echo $matches;
Output for git.master, git.master_jit, rfc.property-hooks
truetrue Warning: preg_match(): Unknown modifier '+' in /in/fT89X on line 31 Warning: Array to string conversion in /in/fT89X on line 32 Array

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
58.77 ms | 401 KiB | 8 Q