PHP
Hypertext Preprocessor or PHP as it is generally known, is a popular, Open Source all-purpose scripting language that is suited for Web development and embedded into HTML. PHP differs from Perl or C scripting languages by using special start and end tags that enclose the code, allowing the programmer to freely move in and out of “PHP mode”. PHP is distinguishable from client-side JavaScript because the code is executed on the server. The client receives the script results without being able to determine the underlying code. Configuring the web server to process all HTML files with PHP allows for safer and more secure scripting possibilities.
PHP is a simple and easy to use scripting language for a beginner developer but offers professional programming options and advanced features. PHP is focused on server-side scripting but has many more possibilities within designing, building, testing and deploying PHP sites. The syntax of PHP is similar to C, Java and Pearl and allows the web developer to create code for dynamically generated web pages in a quick and simple manner.
Although the main target field for PHP is server-side scripting, PHP can also be used for command line scripting and writing desktop applications. Tutorials include overviews and specific information on file manipulation, arrays, strings, functions, operators, variables, data types and installation for PHP. PHP is versatile and can be used with Linux, Unix, Microsoft Windows, Mac OS X and other operating systems. PHP supports many web servers and the developer can choose whether to use PHP as a procedural programming or object-oriented programming tool.
PHP Tutorial - Introduction In this tutorial you will learn about PHP - Introduction to PHP What you should already know What’ s PHP What’ s the difference between PHP and HTML When to use PHP What makes PHP a choice among the other scripting languages What you should already know You have to have good knowledge of the following...
PHP Tutorial - Installation In this tutorial you will learn about PHP - Installation steps involved in Installing Apache server Installing PHP 4 and Installing PHP 5. Installing Apache server 1- Download the installer from Apache site http httpd.apache.org download.cgi 2- Double-click on the installer file to start the installation process....
PHP Tutorial - Syntax In this tutorial you will learn about PHP Syntax - Syntax for Writing a script Scripts VS. File and Comments Writing a script To embed PHP code inside a file it has to be inside a special set of opening and closing tags. PHP supports the following tags sets 1. Opening php and closing 2. Opening...
PHP Tutorials - Data Types In this PHP Tutorial you will learn about PHP Data Types viz. Numeric values String values Boolean values Arrays Objects and NULL. Numeric values There are two numeric values in PHP they are 1. integer Integer numbers don’ t have floating point for example 5 12 1567 2. real or floating point...
PHP Tutorials - Operators Part I In this PHP Tutorial you will learn 1st Part of Operators - The assignment operator The arithmetic operators Bitwise operators - AND OR XOR NOT and Error control operator The assignment operator It’ s used to assign a value to a variable for example to assign the value 100 to the...
Variables In this PHP Tutorial you will learn about Variables different types of Variables like Identifiers Variables Statements and Constants.Variables In this PHP Tutorial you will learn about Variables different types of Variables like Identifiers Variables Statements and Constants. Identifiers Identifier is the name of the data...
PHP Tutorials - Operators In this PHP Tutorial you will learn about Operators - String concatenation operator Comparison operators Logical operators Type casting Combined assignment operator Operators precedence and Operators precedence order. String concatenation operator The string concatenation operator . concatenates two strings. Example php...
PHP Tutorials - Conditional Statements In this PHP Tutorials you will learn about Conditional Statements - if statement if-else statement Alternative if-else statement and switch statement. if statement if syntax is as follows if an expression that return Boolean value...
PHP Tutorials - Functions Part I In this PHP Tutorial you will learn about PHP Functions - Part 1 Function syntax example parameters and variable scope. Sometimes you need to perform an operation more than once in the code to do so you can use functions A function is declared using the following syntax function function_name parameters The...
PHP Tutorials - Loops In this PHP Tutorial you will learn about Loops - while loop do-while loop and the for loop along with syntax and sample PHP loop codes. while loop A while statement executes a code block until a condition is set. Example php x 3;...
PHP Tutorials Functions Part-2 In this PHP Tutorial 2nd Part of PHP Functions you will learn about Variable parameters - func_num_args func_get_args func_get_arg arg_num Variable variables and variable functions Some useful functions - phpinfo and header Variable parameters Sometimes you may not know the number of parameters...
PHP Tutorials - Strings Part I In this PHP Tutorial you will learn about Strings viz The heredoc syntax String length String position Strings comparison String search and Substring selection The heredoc syntax PHP has another way to specify strings called heredoc syntax. The heredoc syntax is very useful for specifying large text. The heredoc...
PHP Tutorials Strings Part 2 In this PHP Tutorial you will learn about Strings 2nd Part - String cleanup String replacement Case functions String formatting and A list of the available type specifiers. String cleanup String cleanup is removing n r t 0 and spaces from any side of the string all cleanup functions take...
Regular expressions In this PHP Tutorials you will learn about Regular Expressions viz Basic PCRE Syntax Character classes preg_match preg_match and Extracting data with regular expressions. Basic PCRE Syntax A regular expression pattern is a string consisting of plain text and pattern metacharacters. The regexp metacharacters define...
PHP Tutorials Arrays In this PHP Tutorial you will learn about Array basics Creating an array Creating a numeric array and Finding the Size of an Array. Array basics An array is made up of elements. Each element has a key and a value. An array holding information about the GPAs of a student has courses names for keys and GPAs for values...
PHP Tutorials - Arrays Part 2 In this PHP Tutorial you will learn Arrays Part 2 - Looping with foreach Sorting arrays and Using Multidimensional Arrays. Looping with foreach The easiest way to iterate through each element of an array is with foreach . The foreach construct lets you run a code block once for each element...
PHP Tutorials File manipulation Part 1 In the PHP Tutorial You will learn about File manipulation Part 1 - Checking file existence A file or directory Determining file size Creating and deleting files and Opening a file for writing reading or appending. Checking file existence You can test for the existence of a file with the file_exists...
File manipulation Part-2 In this PHP Tutorial you will learn the 2nd Part of File Manipulation Reading lines from a file Reading arbitrary amounts of data from a file Writing to a file Creating directories Removing a directory and Opening a directory for reading. Reading lines from a file To read a line from an open file you can use fgets . fgets...
PHP Tutorials Forms In the PHP Tutorial you will learn about PHP Forms - Predefined variables Reading input from forms and Using hidden fields to save state. Predefined variables PHP has several predefined variables called superglobals. Superglobals are always present and available in any PHP script. The superglobals...
PHP Tutorial PHP MySQL In this PHP Tutorial you will learn about PHP and MySQL - Connecting to MySQL Closing a connection Selecting a database Executing a query Inserting data and Retrieving data. Connecting to MySQL To connect to MySQL database server use the function mysql_connect . mysql_connect takes three string arguments...
WAMP SERVER WAMP is an acronym for Windows Apache MySQL and PHP. It is a combination of independently created software’ s bundled together into a SINGLE installation package to set up a SERVER on your machine with out any hassles. It comes with the GPL License. Apache HTTP Server Widely know as Apache Server is the most widely used webserver...
This tutorial will demonstrate how to implement a user login membership system in your website. Though implementing login membership system appears to be a herculean task it is actually lot more simpler than you think. In fact all you need is a single table in your database and a PHP-supported Server. To begin with here is an outline...
What is a Cookie A cookie is flat file based system used to represent a user of the website. It is stored on the local computer of the user. When you visit a website a cookie may be set to represent the user. Next time he visits the website he does not need to identify himself manually; instead the cookie will represent him on that website. With...
This tutorial shows how to handle strings in PHP different output methods functions and the significance of using each of them. A string can be literally expressed in the following ways in PHP 1. Single Quoted 2. Double Quoted 3. HEREDOC 4. NOWDOC from ver. PHP 5.3.0 Different methods used to handle strings are 1. Print 2. Echo 3....