|
Posted by Iván Sánchez Ortega on 12/15/06 01:02
Tom wrote:
> Sorry, I should have been more specific -- I need the actual name of
> the variable itself, not its datatype. So, I need function that does
> the following:
>
> <?php
>
> $myArray = array( );
> $myVariable = "foobar";
>
> echo some_function($myArray); // should echo "myArray"
> echo some_function($myVariable); // should echo "myVariable"
>
> ?>
No can do. Please have a in-depth look at the PHP manual,
chapter "References to variables".
I'll try to show you the inability to know the *name* of a variable. And,
please, before replying, do RTFM.
<?php
$a = "foobar";
$b =& $a;
$c =& $a;
$d =& $a;
unset($a);
echo some_function($c); // WTF??
?>
Now, in your opinion, what should this return?? $b, $c and $d all point to
the same memory address, because of how references work. And the name $a,
which originated that memory address, does not exist. So, do we
return 'b', 'c' or 'd'??
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
Razón #10 : Niegas vivamente la existencia de miles de dioses adorados por
otras religiones, pero te invade la ira cuando alguien niega la existencia
del tuyo.
-- Una de las jocosas, pero no por eso menos ciertas, Diez señales de
que eres un fundamentalista
[Back to original message]
|