Array with constants? vars?


I'm a Delphi programmer, i really don't understand PHP so much...

Im trying to do the following thing, look the code below

I'd like to get something like


Its just a example where i will make my own code like a need...

I'm getting a T_DOUBLE_ARROW error at "$Array" line :(

Can someone help me? :D

Or a best way to do that...

Best Regards,
$Array = ('Name' => $SZ_NAME, 'Lastname' => $SZ_LASTNAME, 'Yearsold' => $SZ_YEARSOLD);
echo "BEGIN";
foreach ($Array as $Array)
echo "$PARAM_SEPARATOR.$Array";

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cmaohioSenior Systems ManagerCommented:
You can't assign $Array to $Array in the foreach statement. I recommend doing this:
foreach ($Array as $field=>$val)
    echo "$PARAM_SEPARATOR.$val";

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cmaohioSenior Systems ManagerCommented:
As a side note, if you need the field name too, then the associative part of the array is placed into $field in the above code.
cebassoAuthor Commented:
Hey man, thank you :D
And i forgot to put $Array = array(...
My problem is solved ;)
Thank you again
Best Regards
cebassoAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.