3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function parseTicketName($ticketName) { preg_match('/^([[:alpha:]]{2})([[:alpha:]]+)([b|f])([[:digit:]]+)$/', $ticketName, $matches); return array( 'system' => $matches[1], 'project' => $matches[2], 'ticket_id' => $matches[3] ); } // 2 first characters is system, then the next letters are project name and the numbers are the ticket id $s = "ASFXB10"; var_dump(parseTicketName($s));
Output for 5.3.0 - 7.1.0
Notice: Undefined offset: 1 in /in/O0cA2 on line 6 Notice: Undefined offset: 2 in /in/O0cA2 on line 7 Notice: Undefined offset: 3 in /in/O0cA2 on line 8 array(3) { ["system"]=> NULL ["project"]=> NULL ["ticket_id"]=> NULL }
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 1 in /in/O0cA2 on line 6 Notice: Undefined offset: 2 in /in/O0cA2 on line 7 Notice: Undefined offset: 3 in /in/O0cA2 on line 8 array(3) { ["system"]=> NULL ["project"]=> NULL ["ticket_id"]=> NULL }