Jump to content

echo before value?


wastedthelight

Recommended Posts

Hi, I was wondering if there's anyone to do the echo before saying what the echo of the value is.

 

<?php  echo $header; ?>
<?php $header= "test"; ?>  

 

Displays nothing, while doing that backward of course does since it reads the page top to bottom.

 

I'm splitting the pages into header and footer and want to header (title of the current page) to be like this so i can just start my pages off saying what the page is with the header= "blah blah blah"

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/61654-echo-before-value/
Share on other sites

You simply can't echo a variable before it is defined. It is ilogical on so many levels.

 

How would i go about doing this then?

 

Anything that would be like

if index.php then display "home"

if contact.php display "contact"

 

 

Something like that you could link me to?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/61654-echo-before-value/#findComment-306910
Share on other sites

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.