3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function processMobileNumber($number = '') { // Removing non number chars from the number $cleanNumber = str_replace("(","", $number); $cleanNumber = str_replace(")","", $cleanNumber); $cleanNumber = str_replace("-","", $cleanNumber); $cleanNumber = str_replace(".","", $cleanNumber); $cleanNumber = str_replace(" ","", $cleanNumber); if (is_numeric($cleanNumber)) { //Phone number must start with a 1. if (substr($cleanNumber,0,1)==="1") { $msisdn = $cleanNumber; } else { $msisdn = "1" . $cleanNumber; } } else { $msisdn = 0; } return $msisdn; } echo(processMobileNumber(234));
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
1234