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