PHP Syntax

PHP Syntax tutorials, documentations and with sample programs.

PHP fwrite() – writing to a file

August 7, 2010

PHP fwrite() function is used for writing contents to a file. It write to the file stream pointed to by handle which is created by fopen() function. Syntax of the PHP fwrite function : fwrite( file handler, string to write , length ) Length argument is optional , and if we specify a length...

Read more »

PHP fopen() – opening, creating a file

August 7, 2010

PHP fopen() function is used for opening a file or url in PHP. It can also be used for creating a file in PHP.We can use two parameters with this function. First parameter is for specifying the file name and second parameter is for specifying the mode for opening that file. Syntax of the...

Read more »

PHP date tutorial

August 7, 2010

PHP date() function is used for formatting the timestamps in a readable / customized format. date() function will accept an optional integer timestamp parameter and will return the formatted date according to the specified date or time on the parameter. If optional timestamp is not present, it will return the current time. If optional...

Read more »

PHP session tutorial

August 6, 2010

Using PHP session variable is a mechanism to store user’s data in server. And sessions will last till we are on the site, it will be destroyed when the user quit the site. One main example of session usage is login information. When a user login to a site with his user name and...

Read more »

PHP cookie tutorial with sample program

August 5, 2010

Cookie is a variable stored in the user computer. Its a mechanism to store the data for future use. Cookies are part of HTTP header and will passed to the server when the site is accessing in browser. We can use cookies for knowing the return visitors or for storing a value in user...

Read more »

PHP $_POST function with forms

August 5, 2010

PHP $_POST function is sued for collection the values passed from a “form using post method”.There are two types of methods are available for a form to send data. They are “get method” and “post method”. $_POST function is applicable for post method only. When we use post method, passed variables and its values...

Read more »

PHP $_GET function with forms

August 5, 2010

PHP $_GET function is sued for collection the values passed from a “form using get method”.There are two types of methods are available for a form to send data. They are “get method” and “post method”. $_GET function is applicable for get method only. When we use get method, passed variables and its values...

Read more »

PHP Switch case

August 4, 2010

PHP Switch case statement is an alternative for complex IF statements with a same expression. Its a best alternative for elseif statements using the same expression. In many situations we need to compare a variable against different values and needs different operations according the values. Switch statement is coming for this requirement. See the...

Read more »

call function in PHP

August 4, 2010

We can create our own function inside our PHP programs for re-usability and making our code optimization purposes. Functions are a block of codes executed only when calling. Codes inside a PHP function will execute when we call a function in PHP program. We can create a function using the “function” statement. Its syntax...

Read more »

PHP continue statement

August 3, 2010

PHP “continue” statement is used within the loops to skip the current loop iteration and goes to the next iteration. See the syntax structure of “continue statement” while ( expression 1) { if ( expression 2 ) { continue ; } // Operation Statements } In this structure if expression 2 return TRUE ,...

Read more »