3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function parseTicketName($ticketName) { global $sites; $system = substr($ticketName, 0, 2); // pull out managment system $ticketName = substr($ticketName, 2); // remove management system // Find first occurence of number $firstNumber = strcspn($str, '0123456789'); // Get project name $project = substr($ticketName, 0, $firstNumber); // Get ticket ID $ticket_id = substr($ticketName, $firstNumber); // remove project, and only thing left is ticket ID return compat($system, $project, $ticket_id); } $s = "ASFX10"; var_dump(parseTicketName($s));
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: str in /in/NCIvK on line 9 Fatal error: Uncaught Error: Call to undefined function compat() in /in/NCIvK:17 Stack trace: #0 /in/NCIvK(21): parseTicketName('FX10') #1 {main} thrown in /in/NCIvK on line 17
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Undefined variable: str in /in/NCIvK on line 9 Warning: strcspn() expects parameter 1 to be string, null given in /in/NCIvK on line 9 Warning: substr() expects parameter 3 to be integer, null given in /in/NCIvK on line 12 Warning: substr() expects parameter 2 to be integer, null given in /in/NCIvK on line 15 Fatal error: Uncaught Error: Call to undefined function compat() in /in/NCIvK:17 Stack trace: #0 /in/NCIvK(21): parseTicketName() #1 {main}
Process exited with code 255.
Output for 5.0.4 - 5.6.28, hhvm-3.10.0
Notice: Undefined variable: str in /in/NCIvK on line 9 Fatal error: Call to undefined function compat() in /in/NCIvK on line 17
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: str in /in/NCIvK on line 9 Fatal error: Call to undefined function compat() in /in/NCIvK on line 17
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Undefined variable: str in /in/NCIvK on line 9 Fatal error: Call to undefined function: compat() in /in/NCIvK on line 17
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Undefined variable: str in /in/NCIvK on line 9 Fatal error: Call to undefined function: compat() in /in/NCIvK on line 17
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: str in /in/NCIvK on line 9 Fatal error: Call to undefined function: compat() in /in/NCIvK on line 17