<?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/').);
$matches = array();
preg_match_all ('^(\d)+^',$url,$matches);
for($x=0;$x<count($matches);$x++)
echo $matches[x][0]."\n";
}
- Output for 5.3.25 - 5.3.26, 5.4.16
- Parse error: syntax error, unexpected '}' in /in/XU12T on line 34
Process exited with code 255. - Output for 5.3.0 - 5.3.24, 5.4.0 - 5.4.15
- Parse error: syntax error, unexpected '}' in 84jtC on line 34
Process exited with code 255.
preferences:
173.4 ms | 1395 KiB | 51 Q