Monthly archive for June 2010

How to prevent web browser to image caching.

June 16, 2010 | Filed Under PHP | Comments Off

The simple way to prevent image caching is to append time stamp with the name on image.

Ex-<img src=’image.jpg?<?php echo time() ?>’ />

In the  above code browser understand a new image at every call. But HTML parser understands“image.jpg” for every call.

Article written by admin

How we can prevent Web browsers caching?

June 15, 2010 | Filed Under PHP | Comments Off
Using HTML meta tags: we can prevent Web browsers caching.
<meta content="Sun, 20 Fed 2000 01:11:11 GMT"
/>
<meta http-equiv="Pragma" content="no-cache" />
Here  free trial offer Meta tag tells the browser, cached copy of the page in back date.That means   browser should never cache the page.
But some browser does not support this approach .If you are working with php and include the header that has Meta definition.
For this case, use php Header function to produce the two meta tags above
<?php
header('Expires: Sun, 20 Fed 2000 01:11:11 GMT');
header('Pragma: no-cache');
?>
Or use
<?php
header('Expires: Sun, 20 Fed 2000 01:11:11 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
?>

In this case visitor will always see the latest contents.

Article written by admin

How can we increase Memory size in php during run time?

June 9, 2010 | Filed Under PHP | Comments Off

using ini_set(‘memory_limit’,’15M’); // now 15M space is  set during run time.

Article written by admin

How can we change the value of php.ini during runtime?

June 9, 2010 | Filed Under PHP | Comments Off

Using string 36 hour ong>ini_set ( string $varname , string $newvalue .
you can change

Article written by admin

How to increase Execution Time Limit in php Using ini_set()

June 9, 2010 | Filed Under PHP | Comments Off

To   increase the execution time for any php script simple use below code.

ini_set(‘max_execution_time’, 240); //240seconds = 4 minutes

Article written by admin

Q What are the two important changes in new versions of PHP that affect old code are ?

June 1, 2010 | Filed Under PHP | Comments Off

Ans: Following two of the most important  recent changes that affect old code are:
The deprecation of the old $HTTP_*_VARS arrays (which need to be indicated as global when used inside a function or met The following superglobal arrays were introduced in PHP » 4.1.0. They are: $_GET, $_POST, $_COOKIE, $_SERVER, $_FILES, $_ENV, $_REQUEST, and $_SESSION.The older $HTTP_*_VARS arrays, such as $HTTP_POST_VARS, still exist as they have since PHP 3. As of PHP 5.0.0, the long PHP predefined variable arrays may be disabled with the register_long_arrays directive.

Article written by admin

Q How the method of our form is POST ?

June 1, 2010 | Filed Under PHP | Comments Off

Ans: If we used the method GET then our form information would live in the $_GET superglobal instead.
You may also use the $_REQUEST superglobal. if you do not care about the source of your request data. It contains of GET, POST and COOKIE data.

Article written by admin

Q What does htmlspecialchars() do ?

June 1, 2010 | Filed Under PHP | Comments Off

Ans: It makes sure any characters that are special in html are properly
encoded  so people can’t inject into commercial your page.

Article written by admin

Q How can we print the data from our form ?

June 1, 2010 | Filed Under PHP | Comments Off

Ans: Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.

A sample output of this script may be:

Hi Joe. You are 22 years old.

Article written by admin

Q What does a strpos() function do ?

June 1, 2010 | Filed Under PHP | Comments Off

Ans:It is a function built into PHP which searches a
string for another string.

Article written by admin

Q Which of the variable that PHP makes automatically available to you ?

June 1, 2010 | Filed Under PHP | Comments Off

Ans:$_SERVER

Article written by admin

© PHPInterviewQuestion.com 2009 - 2012

eXTReMe Tracker