This is a very noob question. The previous developer has coded the lines as below
$a = array("30"=>"ok","40"=>"yes");
$b = "hi";
$c = $a."|".$b;
$d = explode("|",$c);
print_r($d[0]);
How can I display the array array("30"=>"ok","40"=>"yes")
? print_r($d[0]);
seems to print just array
This prints "array
" instead of the actual array values is because this line:
$c = $a."|".$b;
What you're doing is saying:
$c = [array] + [string] + [string];
which will force array
to be transformed into a string
, which is just "array"
if you really want a |
separated string of array indices, you could theoretically do this:
$c = implode("|",$a)."|".$b;
But the real best solution here would be to add something to the array before exploding the array:
$a['50'] = 'hi';
$d = explode("|", $c);