Forum Moderators: coopster

Message Too Old, No Replies

perl to php

         

lindajames

2:41 pm on Aug 27, 2003 (gmt 0)

10+ Year Member



is there an alternative way of doing the following perl code in php?

print <<EndHTML;

<!html code!>

EndHTML
;

any suggestions would be appreciated.

many thanx

Paul in South Africa

2:53 pm on Aug 27, 2003 (gmt 0)

10+ Year Member



<?php
print <<<END
What ever you want to print
END;
?>

PHP Manual [php.net]

jonknee

11:26 pm on Aug 27, 2003 (gmt 0)

10+ Year Member



Even easier, you can just use echo. For example:

<?php

echo "?>

all the HTML/Whatever you could hope for. This is very useful with JS.

<?php ";?>

Is perfectly legit. However, I suggest using more include()'s as it is both more clean and portable (you can make changes application wide really easily with includes). Remember that the difference between print() and echo() is multiple lines. I see a lot of newbies do something like:


<?php

print "aaa";
print "bbb";
print "ccc";
print "ddd";
print "eee";

?>

Unless you get paid by the character, don't do it. Multi-line echo's are smaller (file size wise), faster to type, and faster to execute (less overhead).