Code Help
Posted: Sat Jan 01, 2011 12:13 am
Hey All
I'm a relatively new to PHP, but having several web sites running on PHP, I have seen tons of code from various developers so I am now diving into converting old PHP 4 application that I really like that is not PHP 5 friendly. Right off the bat, I noticed that all the Php declaration started with "<?" and not "<?php". This caused some issues, but i later learned that I could set the short_open_tag = On in my php.ini, but from what I have read it is better to leave that off. My biggest problem are some statements such as:
<SCRIPT SRC="<?=$sitepath?>checkfields.php" LANGUAGE="JavaScript"></SCRIPT>
I'm assuming that the <? and ?> are definitely php declarations, is that correct? Assuming that if I change such a statement to:
<SCRIPT SRC="<?php =$sitepath?>checkfields.php" LANGUAGE="JavaScript"></SCRIPT>
I get an error stating "Parse error: syntax error, unexpected '=' in [xxx.php] location. What does the "=" represent? From what I know about the app, it was written during the days of PHP 4
Thanks,
Robert
I'm a relatively new to PHP, but having several web sites running on PHP, I have seen tons of code from various developers so I am now diving into converting old PHP 4 application that I really like that is not PHP 5 friendly. Right off the bat, I noticed that all the Php declaration started with "<?" and not "<?php". This caused some issues, but i later learned that I could set the short_open_tag = On in my php.ini, but from what I have read it is better to leave that off. My biggest problem are some statements such as:
<SCRIPT SRC="<?=$sitepath?>checkfields.php" LANGUAGE="JavaScript"></SCRIPT>
I'm assuming that the <? and ?> are definitely php declarations, is that correct? Assuming that if I change such a statement to:
<SCRIPT SRC="<?php =$sitepath?>checkfields.php" LANGUAGE="JavaScript"></SCRIPT>
I get an error stating "Parse error: syntax error, unexpected '=' in [xxx.php] location. What does the "=" represent? From what I know about the app, it was written during the days of PHP 4
Thanks,
Robert