Jump to content

[SOLVED] Variable equal to Variable


aeafisme23

Recommended Posts

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

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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.