Monthly Archives: May 2011

PHP strip_tags() Function

The strip_tags() function strips a string from HTML, XML, and PHP tags. It takes two parameters: the string to perform the action on and the specified html tags NOT to strip out. This is a useful function to prevent users

Posted in Php

PHP substr() Function

The substr() function returns a part of a string. substr() is used to get part of a string. The part of the string to be returned is specified as a range using the start and length arguments. If start is

Posted in Php

PHP str_replace() Function

The str_replace() function replaces some characters with some other characters in a string. str_replace — Replace all occurrences of the search string with the replacement string str_replace ( $search ,$replace , $string, $count) $search – Required. Specifies the value to

Posted in Php

PHP strpos() Function

The strpos() function returns the position of the first occurrence of a string inside another string. strpos — Find position of first occurrence of a string If the string is not found, this function returns FALSE. Syntax: strpos($string,$needle,$start) $string –

Posted in Php

PHP file Delete

The php unlink() function is used to delete or destroy files. This function returns TRUE on success, or FALSE on failure. $myFile = “testfile.txt”; $return = unlink($myFile); if(!$return) { echo (“Error deleting on $myFile”); } else { echo (“Deleted $myFile”);

Posted in Php

PHP file fgets

The fgets() function is used to read a single line from a file. After a call to this function the file pointer has moved to the next line. If you had separated your data with new lines then you could

Posted in Php

PHP file fread

Before we can read information from a file we have to use the function fopen to open the file for reading. The fread function is the staple for getting data out of a file. The function requires a file handle,

Posted in Php

PHP File Write

The fwrite() function is a main function that is used to write something into files. This function returns the number of bytes written, or FALSE on failure. Syntax fwrite($file,$string,$length) $file – Required. Specifies the open file to write to $string

Posted in Php

Some useful php functions

* strstr() – for finding string within a string in PHP * eval() – function evaluates a string as PHP code * reset() – function points the internal cursor position at first element of array. * list() – function is

Posted in Php

PHP and AJAX

AJAX Introduction Ajax stands for Asynchronous JavaScript and XML. AJAX is about updating parts of a web page, without reloading the whole page. Ajax is not an Technology in itself. It is a term used for representing the technique used

Posted in Php