3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function formatNum($num){ return sprintf("%+d",$num); } var_dump(formatNum(20)); var_dump(formatNum(-20)); var_dump(formatNum(0));
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(3) "+20" string(3) "-20" string(2) "+0"