This question already has an answer here:
- Alternate to array_column() 6 answers
I have a code which fetches only TANID from the Cookies. Position of TANID is not fixed. This code is working fine on php 7.2 but not on php 5.4
<pre><?php
$myfile = fopen("auth-20180925.log", "r");
$content= fgets($myfile);
$carray=explode('-,-',$content);
$mt = $carray[6];
$data=array_column( array_map(function($v) { return explode('=',trim($v));},explode(';',substr($mt,strpos($mt,'=')+1))),1,0);
$SESSION_COOKIES= ($data['TANID']);
echo $SESSION_COOKIES;
?>
However this code is not running on php 5.4.0 I checked and found array_column is not supported by php 5.4.0. Can someone please suggest how can i achieve this in php 5.4.0
My "auth-20180925.log" looks like this:
2018/09/25 08:32:54-,-dev3.office.abc.eu.com-,-10.00.97.000-,-createAuthenticatedSession-,-00255866-,-"yoya session Created.-,-DST=R4;TANID=31d5865cd24c6c3348gjhdfjghfa79bca
2018/09/17 08:35:09-,-dev3.office.abc.eu.com-,-10.61.88.222-,-logout-,-001586284-,-"yoya session Logout.-,- (TANAUTH=6424f5a9e1b84802abe4b66abc7d8536; MultisecureUserId=00198345; authMarket=be; website=OFFICE; DST=R4; authscheme=SOFTTOKEN; TANID=81110436dfghjdfgj6a402b74; PHPSESSID=fgsfsdf5546545df; market=be)"
</div>