You are here: Accessing a variable named $1? « All PHP « IT news, forums, messages
Accessing a variable named $1?

Posted by gg9h0st on 05/16/06 12:20

it's not vailable to make a variable named start with number like $0var


but while i do something i wrote the code like below.


it works while it seems like there's a variable named $1 :P


so now i'm interested in how i can access that on the other way.


i can't code to access that like [[ $1; ]] neither [[ $GLOBALS[1] or
$GLOBALS['1'] ]]


because $GLOBALS array has '1' key but not 1(number)


as u can see [[ ["v"]=> string(1) "1" ["1"]=> string(4) "this" ]] at
the end of $GLOBALS output. it prints [1] for numberic key 1.


is there other ways i can access that varialbe except using variable
variable?


<?php
#this is header
error_reporting(E_ALL);
?>
<?php
$v = '1';
$$v = 'this';


echo "${$v}" . '<br>';


var_dump($GLOBALS);
?>

 

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

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