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.
Comments
Post a Comment