3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $cpf = "95670785134"; //echo substr($cpf, 0, 3) . '.' . substr($cpf, 3, 3) . '.' . substr($cpf,6,3) . '-' . substr($cpf,-2); $novo = ""; for($i=0;$i<strlen($cpf)-2;$i++){ if($i % 3 == 2 && $i != 8) { $novo .= $cpf[$i] . '.'; } else { $novo .= $cpf[$i]; } } echo $novo . '-' . substr($cpf, -2);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
956.707.851-34