topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday October 6, 2024, 11:35 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: <Script> tag for PHP?  (Read 6227 times)

jeremejazz

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 59
  • hey!
    • View Profile
    • Personal Website
    • Donate to Member
<Script> tag for PHP?
« on: October 18, 2010, 07:03 AM »
Hi, someone told me that the
Code: PHP [Select]
  1. <script>
tag can also be used for calling php functions... is that true?

mwb1100

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

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

See Example #2 on http://www.php.net/m...c-syntax.phpmode.php
« Last Edit: October 18, 2010, 12:06 PM by mwb1100 »

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,759
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: <Script> tag for PHP?
« Reply #2 on: October 18, 2010, 12: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,646
    • View Profile
    • Donate to Member
Re: <Script> tag for PHP?
« Reply #3 on: October 18, 2010, 12:51 PM »
you should be able to use:

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

See Example #2 on http://www.php.net/m...c-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...).