3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php setlocale('UTF-8'); function gorramBasename($path) { $components = explode('/', $path); return array_pop($components); // ugly, but more multibyte-safe than basename() } $path = 'šašek.txt'; echo basename($path) . "\n"; echo gorramBasename($path) . "\n";
based on sQZMm
Output for 5.3.0 - 7.2.0
Warning: setlocale() expects at least 2 parameters, 1 given in /in/Xat3i on line 2 ašek.txt šašek.txt
Output for 5.0.0 - 5.2.17
Warning: Wrong parameter count for setlocale() in /in/Xat3i on line 2 ašek.txt šašek.txt
Output for 4.3.0 - 4.4.9
Warning: Wrong parameter count for setlocale() in /in/Xat3i on line 2 šašek.txt šašek.txt