Jump to content

PHP: name of variable being passed?


justravis

Recommended Posts

In this simple example, I would like the function to output, the name of the var, the letter 'x'

 

<?php

function out($var)
{
    echo "$var<br />";
    #echo $$var;
    #echo func_get_args($var);
    #$varlist=get_defined_vars();
    #echo $varlist[0];
}

$x=3;

out($x);

?>

 

Any ideas?

 

 

Thanks for yr time!

Link to comment
https://forums.phpfreaks.com/topic/67866-php-name-of-variable-being-passed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.