@ 2024-06-26T03:59:58Z <?php
$test_cases = array(
"abc.txt" => '.',
"https://3v4l.org/?foo" => '?',
"https://3v4l.org/#bar" => '#',
$_SERVER['PATH'] => ':',
"PHP 8.3.8" => ' ',
"192.168.1.1" => '.',
"foo\nbar" => "\n",
"snake_case" => '_',
);
foreach ($test_cases as $string => $char) {
if (strtok($string,$char)==pathinfo($string, PATHINFO_FILENAME)) {
echo "\n\nSUCCESS: {$string} => {$char}";
} else {
$string = str_replace("\n","\\n",$string);
$char = str_replace("\n","\\n",$char);
echo "\n\nFAILED: {$string} => {$char}";
echo "\n- strtok(): " . strtok($string,$char);
echo "\n- pathinfo(): " . pathinfo($string, PATHINFO_FILENAME);
};
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 8.3.14 0.006 0.012 20.69 8.3.13 0.003 0.006 18.28 8.3.12 0.011 0.007 18.77 8.3.11 0.006 0.003 20.94 8.3.10 0.006 0.003 24.06 8.3.9 0.005 0.003 26.77 8.3.8 0.016 0.007 30.84 8.3.7 0.000 0.008 30.84 8.3.5 0.007 0.014 30.84 8.2.25 0.009 0.009 18.44 8.2.24 0.009 0.006 18.70 8.2.23 0.008 0.000 22.58 8.2.22 0.006 0.003 37.54 8.2.21 0.012 0.006 26.77 8.2.20 0.012 0.006 30.84 8.2.19 0.015 0.003 30.84 8.1.30 0.012 0.006 17.81 8.1.29 0.010 0.010 30.84
preferences:dark mode live preview
13.72 ms | 403 KiB | 5 Q