Re: Accessing variable with space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Krishna,

Whats wrong with a good old for($array as $key => $value){
echo $key; //returns Krishna
echo $value; //returns 23rd March
}

?

Not sure if spaces are legal in array keys though. That may cause 
problems, you can always encode it - so spaces are %20

Tom

Krishna Srikanth wrote:
>
> Hi,
>
> I got a tricky doubt in my mind. How can we access a dynamic variable 
> with
> space?
>
> $arr = array('Name' => 'Krishna', 'Date of Registration' => '23 March
> 08');
> extract ($arr);
>
> Suppose if I want to access Name, I access it via $Name, Now how can I
> access Date of registration value? Are there any alternative ways to get
> this done. Remember that the key name cannot change and will contain a
> space.
>
> Is there any way to know what variables are created at an instance of the
> program execution?
>
> Regards,
> Manda Krishna Srikanth
> http://www.krishnasrikanth.com <http://www.krishnasrikanth.com>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
> [Non-text portions of this message have been removed]
>
>  


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux