GnuDeveloper.com

PHP Interview Questions

1. How PHP is executed in server?

1.cgi = adv/disadvantage, 2.so or dll  object => adv/disadvantage

2. Why the interface involve?
3. Where to use interface and abstract class?
4. What are design patterns , give 2 example?
5. Different b/w dedicated server and cloud computing?
6. How many ways you will validate soap request?
7. How to do to array and object iteration ?
8. How to use caching for static data like user information and frequent used image?
9. How to set expiration date and time for tpl file?
10. is it possible to extend smarty class? Yes
11. How to create a plug in in Smarty?
12. How many ways time stamp is created in PHP ?
13. What are soap response types ?
xml=not recommended for browser
json=fast
14. what are the mode of soap client?
wsdl mode
Non-wsdl mode
15. How many request & response browser can send ?
16. How many request & response server(apache ,mysql) can handle , where to configure it ?
17. How to do debug with php function?
18. How to create key in mysql;
19. How to get key name in the given table;
        SHOW INDEX FROM node;
        SELECT *FROM node  USE INDEX ( PRIMARY,vid );
        SELECT *FROM node  Force INDEX ( PRIMARY,vid );
        SELECT *FROM node  IGNORE INDEX ( PRIMARY,vid );
 

20. What are the error level in php
21. How to optimize sql other than index; use force index, remove unwanted group by , reduce column in groupby;
22. What are the events for mysql trigers
23. What is highest precedence ? && and
24. What is difference between single quoto and double quoto?
25.Using mysql trigger can we call system command ?
26.How to authendication in apache for specific folder , is it possible to check in user/password in mysql ?
27. How session id is created ? is it based in ip & port ?
28. How many http header we can send ?
29. For the below sql for which colomn the index needs to be created ?
select id ,name, email where salary > 100
30. How will you optimize the web site performance ?
JSMin => removes spaces comment
packer => pack all js file in single file
31.What are the Error Level in PHP?
<?php
error_reporting
(E_WARNING);
?>

0 = turn off all errors
E_all = it shows all errors and warnings
E_parse = compile time errors like syntax error
E_warnings = run time errors but execution will not be halted like include has invalid file path
28.How to represent the below xml as Json object?
<teacher id =101>
<student>
<name>hari</name>
<age>10</age>
</student>
<student>
<name>dass</name>
<age>11</age>
</student>
</teacher>

Json notation:
obj = { "teacher" :{'id':101,'student':[
	                                 {'name':'vivek','age':10 },
                                         {'name':'dass','age':12 }
                                         ] 
		  }
	   } 

28. How to optimize the query?
1. use of proper iIndex.
2. Limiting records in displaying search results.
3. Reduces columns in group by clause.
4. Mention the necessary column name despite of *.
5. Query will execute the where condition from right to left ,
Hence most filter condition pushed to be given right hand side.
29. what is the difference bet myisam and inodb storage engine ?
30. What is persistent cookie?
31. What is difference between friend and static function?
32. How far PHP Supports polymorphism?
php supports only overloading that using magic function. not overriding
33. What is abstraction?
34. How to find second max value in query?
35. I want to upload a file and i want to check wheather it has virus
36. How debugging can be done in php?
DBG, Advanced PHP Debugger (APD), Xdebug.
37. How to use redirect redirectmatchin apache?
38. How to repair the MyISAM tables?
Myisamchk
39. What is dtd?
40. What are the constrain to consider for creating index in tables?
41. What is the use of mysqladmin?
It perfors the administrative operations for the the server's configuration and current status.
42. what is notation declaration and entity declaration?
43. What are the default function, interface, classes loaded in PHP?

<?php
print "<pre>";
print_r(get_declared_classes());
print_r(get_defined_functions());
print_r(get_declared_interfaces()); 
?>

Function:
Array
(
[0] => zend_version
[1] => func_num_args
[2] => func_get_arg
[3] => func_get_args
[4] => strlen
[5] => strcmp
[6] => strncmp
[7] => strcasecmp
[8] => strncasecmp
)
Interface:
Array
(
[0] => Traversable
[1] => IteratorAggregate
[2] => Iterator
[3] => ArrayAccess
[4] => Serializable
[5] => Reflector
[6] => RecursiveIterator
[7] => OuterIterator
[8] => Countable
[9] => SeekableIterator
[10] => SplObserver
[11] => SplSubject
)
Classes:
Array
(
[0] => stdClass
[1] => Exception
[2] => ErrorException
)

Groups: