3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $cep_1 = '04157-000'; $cep_2 = '04157000'; if( !preg_match('/-/',$cep_2) ){ echo substr_replace($cep_2, '-', 5, 0); }else{ echo 'com'; }
based on bu5CY
Output for 4.3.0 - 7.2.0
04157-000