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 preg_match('/^([[:alpha:]]+)([[:digit:]]+)$/', $ticketName, $matches); return array( 'system' => $system, 'project' => $matches[1], 'ticket_id' => $matches[2] ); } // 2 first characters is system, then the next letters are project name and the numbers are the ticket id $s = "ASFX10"; var_dump(parseTicketName($s));
Output for 4.3.0 - 7.1.0
array(3) { ["system"]=> string(2) "AS" ["project"]=> string(2) "FX" ["ticket_id"]=> string(2) "10" }