php - Get the name of a variable in a string -


hi want create function in can pass variable , output name of variable , value sting. this:

$firstname = 'john'; $lastname = 'doe';  echo my_function($firstname); // outputs: "var name: firstname , has: john" echo my_function($lastname);  // outputs:  "var name: lastname , has: doe" 

take @ get_defined_vars()

you can var_dump , show variables defined. loop through , dump each ones value too.

http://php.net/get_defined_vars


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -