Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts

Thursday, April 8, 2010

stristr trick questions

What is output of the following

echo stristr('user@EXAMPLE.com', 'R'); //
echo stristr('user@EXAMPLE.com', 'r'); //

Output

r@EXAMPLE.com
r@EXAMPLE.com

The stristr is case insensitive.

strstr trick questions

What is output of the following

strstr("php@interview",'@');
strstr("php@interview",'@',true);

Answer

@interview
php

This is the mostly asked interview question

Wednesday, April 7, 2010

captcha in php

Question: What is captcha in php

Answer

Captcha is nothing but an image which contains numbers,characters with an distorted background

Acronym for captcha is

Completely Automated Public Turing test to tell Computers and Human Apart

Simply saying : It is a mechanism for protecting spams in an application.






Tuesday, April 6, 2010

Explain Static keyword in php

Answer

Declaring class members or methods as static makes them accessible without needing an instantiation of the class. A member declared as static can not be accessed with an instantiated class object (though a static method can).

Saturday, April 3, 2010

what is Variable variables

Answer:

A variable variable takes the value of a variable and treats that as the name of a variable

The above may be little bit confusing

See the example
//declare a variable

variable of variable means

$$a = 'test';

now $allphpinterviewquestions value is test


Thursday, April 1, 2010

initialize a variable in single quote and double quote

If the variable is declared in the double quote the variable will be parsed by php

if it is declared in single quote means it will not be parsed by php

so initializing a variable a single quote is always better.

Also we can add variable inside the double quote

example

$a ="this is $var allphpinterviewquestions";