So I have this big string, which includes in the middle the following:
"(...) Status: Ativo
Identificador: F36CE5
Meio de Pagamento: Cartão de crédito
Data de contratação: 25/03/2015
Data de expiração: 25/03/2017 (...)"
* the "(...)" is just to identify that there are more content before and after this part
My goal is to isolate only the part right after "Identificador:"
, i.e., I need to grab the value "F36CE5"
(which is different every time, of course) and set it to a variable.
I tried the following code:
$initialString = "Status: Ativo
Identificador: F37CE5
Meio de Pagamento: Cartão de crédito
Data de contratação: 25/03/2015
Data de expiração: 25/03/2017";
$arr = explode(":", $initialString);
$important = $arr[2];
echo $important;
But with this I am getting
F37CE5
Meio de Pagamento
What should I do to get only F37CE5
?
Is there a way to tell PHP: "Give the string that is right after 'Identificador:', and nothing more" ?