<?php // your code goes here $str = '081'; $newStr = sprintf("%'.03d", $str); var_dump($str, $newStr);
Standard input is empty
string(3) "081" string(3) "081"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!