Posted by Jerry Stuckle on 09/29/47 12:01
Peter Pei wrote:
> "Giovanni" <blastingproton@gmail.com> wrote in message
> news:bfe96afe-98dc-4850-98a8-890b0de68daf@j20g2000hsi.googlegroups.com...
>> Hi! I've an array of string like this:
>>
>> $arraystring["name"]="John";
>> $arraystring["age"]="50";
>> $arraystring["work"]="teacher";
>>
>> $arraystring is global variable.
>>
>> I'm trying to code a function that get a string as parameter and print
>> the relative arraystring's value.
>>
>> function printArrayStr($key)
>> {
>> global $arraystring;
>> echo $arraystring["$key"];
>> }
>>
>> What do I wrong?! :(
>>
>> tnx, people!
>
>
> How amazing this is. His code worked with 5.2.5 for sure. Obviously
> none of the previous repliers cared to test his code, and went ahead
> with stupid answers any way.
>
> His code works 100% as long as he calls it the right way, for example
> printArrayStr("age"). Obviously he will get notice if he calls
> printArrayStr(age).
>
> make sure your answers is relevant, otherwise you are playing pure
> stupid.
> =============================================
(Top posting fixed)
At least the others didn't top post.
And no, I didn't test his code because he didn't post where the problem
is.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|