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? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -