PHP variable value from string -


how can value variable string ?

$member_student        = 3600; $selecteditem = "member_student"; $price = "$" . $selecteditem; print_r($price); //prints $member_student instead of 3600 

i cannot use eval function.

use curly braces denote variable:

$member_student        = 3600; $selecteditem = "member_student"; $price = ${$selecteditem}; print_r($price); // prints 3600 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -