DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: <Script> tag for PHP?  (Read 7,542 times)

jeremejazz

  • hey!
  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 59
<Script> tag for PHP?
« on: October 18, 2010, 12:03 PM »
Hi, someone told me that the
Code: (php)
<script>
tag can also be used for calling php functions... is that true?

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
Re: <Script> tag for PHP?
« Reply #1 on: October 18, 2010, 05:03 PM »
you should be able to use:

Code
<script language="php"> ... </script>

See Example #2 on http://www.php.net/manual/en/language.basic-syntax.phpmode.php
« Last Edit: October 18, 2010, 05:06 PM by mwb1100 »

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 9,827
    • Participated in NANY Challenge Eight Times
    • Cody Award
Re: <Script> tag for PHP?
« Reply #2 on: October 18, 2010, 05:08 PM »
If you just want to do a short section of PHP, why wouldn't you use the normal PHP tags? It's been a long time since I've done any PHP, but isn't it something simple like <?php>?

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,652
    • Cody Award
    • Participated in NANY Challenge Five Times
Re: <Script> tag for PHP?
« Reply #3 on: October 18, 2010, 05:51 PM »
you should be able to use:

Code
<script language="php"> ... </script>

See Example #2 on http://www.php.net/manual/en/language.basic-syntax.phpmode.php

The moral of the story (at the link you posted) seems to be yes you can do it, but it's a bad habbit/idea that will bite you in the ass down the road. <?PHP ...code...  ?> or <?=$Value?> are both universally safe in any environment/version or mixture of code.


Not to mention it looks too much like a Java Script tag of your skimming something large in a hurry (We've all done that at least once...).

Original address: https://www.donationcoder.com/forum/index.php?topic=24298.0