aeafisme23 Posted November 12, 2009 Share Posted November 12, 2009 I would like to have a variable in this situation be REPLACED by $orange so that when I echo $apple below it will read the $orange variable from the include and say I am an orange. This is a very dumbed down version of what I am doing and I have 100's of pages that use the include page and each page starts out with declaring $apple=$orange or $apple=$pineapple or in a Generic way I just leave the variable as is. I hope I did not make this more confusing. Content: <?php include("includepage.php"); $apple = $orange; ?> <?php echo $apple; ?> Include Page $apple ="I am an apple"; $orange ="I am an orange"; Link to comment https://forums.phpfreaks.com/topic/181263-solved-variable-equal-to-variable/ Share on other sites More sharing options...
mrMarcus Posted November 12, 2009 Share Posted November 12, 2009 is this a statement or a question? either way, i'm left will this sudden urge for fruit. Link to comment https://forums.phpfreaks.com/topic/181263-solved-variable-equal-to-variable/#findComment-956251 Share on other sites More sharing options...
Garethp Posted November 12, 2009 Share Posted November 12, 2009 Um... Try putting (At the top of the include page) $appleorriginal = "I am an apple"; and then on the other <?php $apple = $appleorriginal; echo $apple; ?> Link to comment https://forums.phpfreaks.com/topic/181263-solved-variable-equal-to-variable/#findComment-956252 Share on other sites More sharing options...
aeafisme23 Posted November 12, 2009 Author Share Posted November 12, 2009 Um... Try putting (At the top of the include page) $appleorriginal = "I am an apple"; and then on the other <?php $apple = $appleorriginal; echo $apple; ?> Thank you, you top of the include page was pretty much what was wrong, i was defining a variable in the wrong order so on default i was always going to call apple. Thanks again. mrMarcus, thank you for making me laugh Link to comment https://forums.phpfreaks.com/topic/181263-solved-variable-equal-to-variable/#findComment-956256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.