1. Home
  2. Computing & Technology
  3. PHP / MySQL

Use PHP in a File That Supports Mixed Scripting Languages

How to use PHP in a mixed scripting language file

By Angela Bradley, About.com

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.
More PHP / MySQL Quick Tips

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Use PHP in a file that supports mixed scripting languages

©2008 About.com, a part of The New York Times Company.

All rights reserved.