3v4l.org

run code in 300+ PHP versions simultaneously
<?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); }; }
Output for git.master, git.master_jit
SUCCESS: abc.txt => . FAILED: https://3v4l.org/?foo => ? - strtok(): https://3v4l.org/ - pathinfo(): ?foo FAILED: https://3v4l.org/#bar => # - strtok(): https://3v4l.org/ - pathinfo(): #bar FAILED: /usr/bin:/bin => : - strtok(): /usr/bin - pathinfo(): bin FAILED: PHP 8.3.8 => - strtok(): PHP - pathinfo(): PHP 8.3 FAILED: 192.168.1.1 => . - strtok(): 192 - pathinfo(): 192.168.1 FAILED: foo\nbar => \n - strtok(): foo - pathinfo(): foo\nbar FAILED: snake_case => _ - strtok(): snake - pathinfo(): snake_case

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:
32.05 ms | 406 KiB | 5 Q