Not sure what your goal is here but the easiest (and most efficient) way
to get the first character of a string is :
$string = 'abcdef';
print $string{0}; // prints a
print $string{3}; // prints d
So in your case, maybe the following craziness is what you're wanting :
${$string{0}} = 'crazy';
print $a; // prints crazy
Regards,
Philip Olson
On Fri, 31 Aug 2001, Papp Gyozo wrote:
>
> $GLOBALS[substr($string, 0, 1)]
> or :
>
> $tmp = substr($string, 0, 1);
> ${$tmp} = 'add whatever value you want';
>
> ----- Original Message -----
> From: Stig-Ørjan Smelror <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, August 31, 2001 9:35 AM
> Subject: [PHP] help with strings...
>
>
> > Hei all.
> >
> > I've got this string, $string = "test"; and I want to make a $t; out of
> > $string.
> > Is this possible?
> >
> > I tried ${substr($string, 0, 1)}, but that didn't work ;)
> >
> >
> > Any help appreciated.
> >
> >
> > TIA.
> > --
> > Stig-Ørjan Smelror
> > Systemutvikler
> >
> > Linux Communications AS
> > Sandakerveien 48b
> > Box 1801 - Vika
> > N-0123 Oslo, Norway
> >
> > tel. +47 22 09 28 80
> > fax. +47 22 09 28 81
> > http://www.lincom.no/
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]