You are here: Re: Help with Javascript: naming variables using other variables « HTML « IT news, forums, messages
Re: Help with Javascript: naming variables using other variables

Posted by Leif K-Brooks on 11/07/05 08:04

X l e c t r i c wrote:
> Is $var1.bar PHP 5 dot notation ?
>
> If so, then that explains why it doesn't work for me. The host I tried
> it at is at PHP 4.3.11.

No, it's concatenation
<http://php.net/manual/en/language.operators.string.php> combined with
abuse of a PHP misfeature which turns missing constants into strings. It
works fine with my copy of PHP 4.3.10:

leif@debian:~$ php -v
PHP 4.3.10-15 (cli) (built: May 9 2005 08:54:56)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
leif@debian:~/ecritters/web/html$ php
<?php
$var1 = "foo";
${$var1.bar} = "great!";
print $foobar;
// Outputs "great!"
?>
great!leif@debian:~$

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация