3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $name = "IPC_IPCamera_13_7_24_9_57_45.jpg"; $newName = ""; $parts = explode("_", $name); for ($i = 0; $i < count($parts); $i++) { $part = $parts[$i]; if (strlen($part) == 1) { $part = "0" . $part . "_"; } $newName .= $part; } echo $name . "\n"; echo $newName;
Output for 4.3.0 - 7.1.0
IPC_IPCamera_13_7_24_9_57_45.jpg IPCIPCamera1307_2409_5745.jpg