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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.