PHP simple : PHP tutorial, MySQL tutorial
PHP Tutorial - Free PHP Script

Home | Tutorials | PHP & MySQL Resources | Web Tools
Introduction & Get Start
Using Form
PHP
PHP Tags
PHP Variables
PHP Control Structures
MySQL
Create Database & Table
Database Connection
Insert Record
Select Record
Update Record
Delete Record

PHP tags

Opening & Ending PHP Tags

To open a block of PHP code in a page you can use one of these four sets of opening and closing tags

Opening Tag Closing Tag
<? ?>
<?php ?>
<% %>
<script language="php"> </script>

The first pair (<? and ?>) is called short tags. You should avoid using short tags in your application especially. Short tags are only available only explicitly enabled setting the short_open_tag value to On in the PHP configuration file php.ini. This is important term when you need to put PHP codes in your files.

* For all PHP code in this website I will use the second pair, <? and ?>.

First example, create a file named echo.php and put it in your web servers root directory.

Example : echo.php
<html>
<head>
<title>My First PHP Page</title>
</head>
<body>
<?
echo "Welcome! You are starting PHP Programming.";
?>

</body>
</html>

To view the result, open your browser and go to http://localhost/echo.php or http://127.0.0.1/echo.php.

Result of this codes :

Welcome! You are starting PHP Programming.

This example shows how to insert PHP code into an HTML file. This insert style is called "embed" that you can put the PHP codes in everywhere in HTML tags. But must to use with open tag (<?) and end with close tag (?>) for make an area of PHP code. Also, if your file included with PHP codes you must to save this file to .php format.

It also shows the echo statement used to output a string. See that the echo statement ends with a semicolon ";". Every command in PHP must end with a ";". If you forget to use semicolon or use colon instead after a command you will get an error message.

Strings are probably what you will use most in your PHP script. From concatenating, looking for patterns, trim, chop etc. So I guess it's a good idea to take a better look at this creature. We will also take a peek at some string functions that you might find useful for everyday coding.


Send Email to Multiple Persons
You can send email to mutiple persons in one time. This tutorial shows you in 1 file with a normal form. When you submit, this file will be sent an email immediately to the target emails from your database.
Easy Counter
Very simple, short and easy codes. This counter plus by 1 every time you refresh your browser.


PHPsimple.net
info@phpsimple.net