language php code example
Example 1: what php can do
PHP can generate dynamic page content.
PHP can create, open, read, write, delete, and close files on the server.
PHP can collect form data.
PHP can send and receive cookies.
PHP can add, delete, modify data in your database.
PHP can be used to control user-access.
PHP can encrypt data and apply validation.
PHP used to send and receive E-Mails.
PHP can be used to integrate with other third party tools.
PHP can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.
Example 2: CODE PPHP
These methods are just messy. Short-opening tags and ASP-styled tags are not always enabled on servers. The <script language="php"></script> alternative is just out there. You should just use the traditional tag opening:
<?php?>
Coding islands, for example:
<?php
$me = 'Pyornide';
?>
<?=$me;?> is happy.
<?php
$me = strtoupper($me);
?>
<?=$me;?> is happier.
Lead to something along the lines of messy code. Writing your application like this can just prove to be more of an
inconvenience when it comes to maintenance.
If you have to deal chunks of HTML, then consider having a templating system do the job for you. It is a poor idea to rely on the coding islands method as a template system in any way, and for reasons listed above.