3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $phoneNumbers = array('41N XR8 L143','CRCCCRZZ65','77U.641.2lL7','N9N 481N117','I00F7CIKOK','A7Z.Z3M.AAM0','G73-V1N-9572','8N5 54WECN85','6BF97B7711','F2W W0718W1','E16 EGTj6JE','EZNGUE2Q0E','6DI.6DW.D0D2','88W 6RW 0HWF'); foreach($phoneNumbers AS $phoneNumber) { $newPhoneNumber = ""; for($i=0;$i<count($phoneNumber);$i++){ $number = phoneNumber[$i]; if(!is_numeric($number)){ switch($number){ case "A":"B":"C" : $number = 2;break; case "D":"E":"F" : $number = 3;break; case "G":"H":"I" : $number = 4;break; case "J":"K":"L" : $number = 5;break; case "M":"N":"O" : $number = 6;break; case "P":"Q":"R":"S" : $number = 7;break; case "T":"U":"V" : $number = 8;break; case "W":"X":"Y":"Z" : $number = 9;break; default : $number = ""; } } $newPhoneNumber .= $number; } $newPhoneNumbers[] = implode("-",str_split($newPhoneNumber,3)); }
Output for 5.3.0 - 5.4.24
Parse error: syntax error, unexpected '[' in /in/dhRWe on line 7
Process exited with code 255.