1. Computing & Technology

Discuss in my forum

Use PHP in a File That Supports Mixed Scripting Languages

How to use PHP in a mixed scripting language file

By , About.com Guide

You already know how to start and finish a PHP file using regular methods. The code below shows the common way of creating a PHP file:
 <?php 
 echo "Hello About.com!";
 ?> 
What you might not know is that you can run this same bit of code using the script tag:
 <script language = "php"> 
 echo "Hello About.com!";
 </script> 
The script tags can identify a language (PHP or otherwise) who's code you will be running in a section. This is useful in a file that allows for mixed scripting languages. While it is not a common setup, it is sometimes used. By using the script tags, you can easily identify what language is where, and when it switches.

©2012 About.com. All rights reserved.

A part of The New York Times Company.