<?php
function parseTicketName($ticketName) {
global $sites;
$system = substr($ticket, 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));
Warning: Undefined variable $ticket in /in/ffZL7 on line 5
Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /in/ffZL7 on line 5
array(3) {
["system"]=>
string(0) ""
["project"]=>
string(2) "FX"
["ticket_id"]=>
string(2) "10"
}
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $ticket in /in/ffZL7 on line 5
array(3) {
["system"]=>
string(0) ""
["project"]=>
string(2) "FX"
["ticket_id"]=>
string(2) "10"
}