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\n"; } else{ echo "false\n"; } $testlen = strlen('/bob/'); if(false == (substr_compare('http://localhost/events/10','/events/',-$testlen)===0)){ echo "true\n"; } else{ echo "false\n"; } $url = 'http://192.168.1.0/events/10'; //$eventid = intval(strpos($url,'/events/').); preg_match('^(\d)+^',$url,$matches,PREG_OFFSET_CAPTURE); $arraylen = count($matches); for($x=0;$x<$arraylen;$x++){ echo $matches[0][$x][0]."\n"; }
Output for git.master, git.master_jit
true true 1 Warning: Trying to access array offset on value of type int in /in/kMEc7 on line 34
Output for rfc.property-hooks
true true 1 Warning: Trying to access array offset on int in /in/kMEc7 on line 34

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:
44.55 ms | 401 KiB | 8 Q