Question about array output: This post was last edited by redirggg at 11:55:04
Array( [IsSuccesfull] => 1 [Results] => Array ( [SingleResul] => Array ( [0] => Array ( [QueryId] => 100093 [PathId] => 1 [SourceFolder] => 1111111 ) [1] => Array ( [QueryId] => 100093 [PathId] => 2 [SourceFolder] => 1111 ) ) ))
How to output such arrays?
Reply to discussion (solution)
What do you want to output ??
To output QueryId, PathId, and SourceFolder, if QueryId is repeated, only the first one is output.
Suppose $ t is your array.
$ar=array();foreach($t['Results']['SingleResul'] as $v){ if(!isset($ar[$v['QueryId']])){ $ar[$v['QueryId']]=$v; }}foreach($ar as $v) echo join(' | ' , $v)."
";
Thank you very much jordan102!
Suppose $ t is your array.
$ar=array();foreach($t['Results']['SingleResul'] as $v){ if(!isset($ar[$v['QueryId']])){ $ar[$v['QueryId']]=$v; }}foreach($ar as $v) echo join(' | ' , $v)."
";
Ask Daniel, for example, the array is as follows:
[1] => Array
(
[QueryId] = & gt; 100093
[PathId] => 2
[SourceFolder] = & gt; 1111
)
If PathId = 2 in an element, the array element is deleted. Ask for advice.