I need help creating an array within an array using this data. This data is already in an array like this:
[0] => META>>DisplayName=Donald Trump
[1] => META>>[email protected]
[2] => META>>EmployeeID=E13342
[3] => CLOUD>>DisplayName=Hillary Clinton
[4] => CLOUD>>[email protected]
[5] => CLOUD>>EmployeeID=E13423
[6] => AD>>DisplayName=Bernie Sanders
[7] => AD>>[email protected]
[8] => AD>>EmployeeID=E121233
I'm trying to turn it into something like this:
array(
[meta] => Array
(
[DisplayName]=>Donald Trump
[EmailAddress]=>[email protected]
[EmployeeID]=>E666420
[EmployeeType]=>E
)
)
What I have so far but it's not working:
$properties = array("DisplayName",
"EmailAddress",
"EmployeeID",
"EmployeeType")
$data = array();
foreach($output as $line) {
$sep = explode(">>",$line);
$data[$sep[0]] = array();
for ($x=0;$x<count($properties);$x++) {
$split = explode("=",$sep[1]);
$data[$sep[0]][$p] = $split[1];
}
}
$pcome from? change that to$properties[$x]and it should work