Skip to main content

Posts

Showing posts from March, 2013

feof in php example

this function returns the Boolean values if the file pointer is located at the beginning of the file. <?php $fp = fopen("myfile.txt","r"); $count=0; while(!feof($fp)) { echo fgets($fp); $count++; } echo "<br>" total lines are $count"; ?>

fseek function in php example

fseek function in php: by using this function we can locate the file pointer on the specified location. <?php $fp= fopen("myfile.text",' w+'); fwrite ($fp, "hello scott"); fseek($fp,2); $size= file size("myfile.text"); echo fread($fp,$size); ?>

file handling in php example

file handling in php example by using this concept we can read a content of a file and we can write the content in a files. to read and write the contents first. we have to open the file using a file mode

phpinfo() function in php example

phpinfo() function in php example                                                          by using this function we can display the all configuration directives on web page <?php phpinfo(); ?> 

$_ENV in php example

$_ENV  in php example :-                                           by using this super global variable we can get the information of environmental variables  environmental variables are nothing but the o/s variables.

configuration directives to work with session

configuration directives to work with session. 1. session.auto_start:-                               by using this directives we can  initialize the session. when the request is started. the default value is 0. by changing the value as 1 we can initialize the session. 2. session.save_handler - handles used to store the retrieve the session the default value is files. 3. session.save_path:-                                    provide the path where you want to save the session. 4. session.use_cookies                                        weather to use cookie or not to store the session.   

difference between cookie and session in php

difference between cookie and session in php cookie :-  1. cookie reside in client system. 2 cookie store small amount of data. 3.cookie are not secured. 4. cookie can store only text data. 5. cookie are burden in client system. session:- 1. session reside web server. 2. session can store huge amount of data. 3. session are secured. 4. session store any type of data.  

session in php example

by using this super global variable we can create the session and we can read the session.  session are using to maintain the state of an application. there reside in web server.

query string in php example

query string is a small amount of data on the url address followed by ? mark. along with the input control values if you want to send some extra information form one page to another page. we are using query string is the combination of name and value. <form method ="post" action="page1.php?city=hyd&inst=php"> <input type="text" name="text1"></br> <input type="submit" value="submit" name="submit"> </form> <?php echo $_request['city']; echo $_request['inst']; echo $_request['text1'];  ?>