How can I get the last 2 digits of:
200912
to my object:
$year = $flightDates-&
Example 1 : You can just strip the tags with strip_tags
and use substr
$number = '200912 ' ;
$year = substr(strip_tags($number), 0,2);
var_dump($year);
Example 2 : You can also use simplexml_load_string
with substr
$number = '200912 ' ;
$year = substr(simplexml_load_string($number),0,2);
var_dump($year);
Output
string '20' (length=2)