|
26.) How to create a text file in php?
$filename = "/home/user/guest/newfile.txt"; $file = fopen( $filename, "w" ); if( $file == false ) { echo ( "Error in opening new file" ); exit(); } fwrite( $file, "This is a simple test\n" ); fclose( $file ); |
27.) How to strip whitespace (or other characters) from the beginning and end of a string ?
The trim() function removes whitespaces or other predefined characters from both sides of a string.
28.) What is the use of header() function in php ?
The header() function sends a raw HTTP header to a client browser.Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function.
29.) How to redirect a page in php?
The following code can be used for it, header("Location:index.php");
30.) How stop the execution of a php scrip ?
exit() function is used to stop the execution of a page
The trim() function removes whitespaces or other predefined characters from both sides of a string.
28.) What is the use of header() function in php ?
The header() function sends a raw HTTP header to a client browser.Remember that this function must be called before sending the actual out put.For example, You do not print any HTML element before using this function.
29.) How to redirect a page in php?
The following code can be used for it, header("Location:index.php");
30.) How stop the execution of a php scrip ?
exit() function is used to stop the execution of a page