Final)
Final)
Final)
INDEX
Write a PHP code to check PHP Version Write a PHP Code to demonstrate variables Build a basic PHP Form Write a PHP code to read the contents of a file Write a PHP Code to check List Selection Write PHP Code to demonstrate functions Write a PHP code to demonstrate Arrays Write a PHP code to demonstrate a string manipulation with a Pig Latin Translator Write a PHP code to demonstrate a class Creating a Database Driven Application with PHP
1 INTRODUCTION TO PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. It also has evolved to include a command-line interface capability and can be used in standalone graphical applications. PHP can be deployed on most web servers and as a standalone interpreter, on almost every operating system and platform free of charge. A competitor to Microsoft's Active Server Pages (ASP) server-side script engine and similar languages, PHP is installed on more than 20 million websites and 1 million web servers. PHP was originally created by Rasmus Lerdorf in 1995. The main implementation of PHP is now produced by The PHP Group and serves as the de facto standard for PHP as there is no formal specification. PHP is free software released under the PHP License which is incompatible with the GNU General Public License (GPL) due to restrictions on the usage of the term PHP. While PHP originally stood for "Personal Home Page", it is now said to stand for "PHP: Hypertext Preprocessor", a recursive acronym. Many high-profile open-source projects ceased to support PHP 4 in new code as of February 5, 2008, because of the GoPHP5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5. As of 2011 PHP does not have native support for Unicode or multibyte strings; Unicode support is under development for a future version of PHP and will allow strings as well as class-, method-, and functionnames to contain non-ASCII characters. PHP interpreters are available on both 32-bit and 64-bit operating systems, but on Microsoft Windows the only official distribution is a 32-bit implementation, requiring Windows 32-bit compatibility mode while using Internet Information Services (IIS) on a 64-bit Windows platform. Experimental 64-bit versions of PHP 5.3.0 were briefly available for MS Windows, but have since been removed.
Uninstallation
Navigate to the drive where the php folder is located.Select the folder. Delete the PHP folder from the drive Next, navigate to C:\WINDOWS and search for a file named php.ini and select the file. Delete this file from C:\WINDOWS PHP has been completely removed from the system. Its as simple as this.
HERE; }
return $output;
10 WRITE A PHP CODE TO DEMONSTRATE A STRING MANIPULATION WITH A PIG LATIN TRANSLATOR
<html> <head> <title>Pig Latin Generator</title> </head> <body> <h1>Pig Latin Generator</h1> <? if (empty($_POST["inputString"])) { print <<<HERE <form action = "index.php" method = "post"> <textarea name = "inputString" rows = 20 cols = 40></textarea> <input type = "submit" value = "pigify"> </form> HERE; } else { $inputString = $_POST["inputString"]; //there is a value, so we'll deal with it //break phrase into array $words = split(" ", $inputString); foreach ($words as $theWord) { $theWord = rtrim($theWord); $firstLetter = substr($theWord, 0, 1); $restOfWord = substr($theWord, 1, strlen($theWord)); print "$firstLetter) $restOfWord <br> \n"; if (strstr("aeiouAEIOU", $firstLetter)) { //it's a vowel $newWord = $theWord . "way"; } else { //it's a consonant $newWord = $restOfWord . $firstLetter . "ay"; } // end if $newPhrase = $newPhrase . $newWord . " "; } // end foreach print $newPhrase; } // end if ?> </body> </html>