Somadder Abhijit
Somadder Abhijit

Reputation: 95

Why PHP Script Tag

There are 5 tags available to start a php code block. I've read about Script Tags:

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

Definition: Script tags were introduced so that HTML editors that were able to ignore JavaScript but were unable to cope with the standard PHP tags could also ignore PHP code.

Can anybody explain about the definition?

Upvotes: 1

Views: 170

Answers (2)

rap-2-h
rap-2-h

Reputation: 32028

These tags were created for IDE and text editors long time ago. At that time, IDE and text editors did not know PHP, so PHP had to pretend to be javascript or similar.

You do not need to use them now. You may use <?php, the current "default" tag. the <script> tag was removed from PHP 7

Upvotes: 0

Lakshmi
Lakshmi

Reputation: 118

There are four different pairs of opening and closing tags which can be used in PHP. one of those

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

Defention : This is used to differentiate from Javascript code but HTML editors are unable to cope up even with standard PHP tag

Note: In PHP 7 <script language="php"><script> Tags are removed.

<?php ?> is the most commonly used and recommended to use it.

Upvotes: 2

Related Questions