I have this array
array(1) { [0]=> array(5)
{ ["ppc_acc_name"]=> string(9) "Test test"
["ppc_acc_username"]=> string(4) "ttes"
["ppc_acc_password"]=> string(3) "tes"
["ppc_acc_answer"]=> string(3) "trt"
["ppc_acc_link_client"]=> string(1) "3" } }
And I have trying to access the values in the array via a foreach loop. I want to use key string identifiers so I can control the formatting of my loop as it outputs. The problem is that it dosent let me use key string identifiers in my foreach loop.
This loop outputs Test test ttes tes trt 3 which is correct
<?php foreach ($ppcAccDetails as $details): ?>
<?php foreach ($details as $detail): ?>
<?php echo $detail." "; ?>
<? endforeach; ?>
<? endforeach; ?>
But I want to use the keys $detail[‘ppc_acc_name’] the results output only the first characters.
incorrect result: T t t t 3
You have a nested array. Just do this to access individual items:
In the
foreachloop context, you would do this, and get rid of the innerforeachloop.