3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function mb_pathinfo($filepath) { preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im',$filepath,$m); if($m[1]) $ret['dirname']=$m[1]; if($m[2]) $ret['basename']=$m[2]; if($m[5]) $ret['extension']=$m[5]; if($m[3]) $ret['filename']=$m[3]; return $ret; } print_r(mb_pathinfo("/mnt/files/飛兒樂團光茫.mp3"));
based on guKXE
Output for 4.3.0 - 7.3.0
Array ( [dirname] => /mnt/files [basename] => 飛兒樂團光茫.mp3 [extension] => mp3 [filename] => 飛兒樂團光茫 )