Anda di halaman 1dari 29

Page 1 of 29 OPPs:

1) What are the principle concepts of OPPs? Abstraction, Polymorphism, Inheritance, Encapsulation 2) What is a class? A class is a way of binding data members and member functions in a single unit.

3) What is a Object? An instance of class is nothing but object. (Implies) :: (Scope resolution operator) 4) What is $this? $this is a sudo variable, for calling method in the same class or extended class 5) How do you invoke parent class method in child class? Parent::method_name(); 6) What is a instance? Allocating sufficient memory for the data members 7) What is Inheritance? Inheritance is the capability of a class to use the properties and methods of another class. When you extend a class, the subclass inherits all of the public and protected methods from the parent class. Inheritance is done by using the keyword extends. Use: Inheritance helps the code to be reused in many situations, using inheritance you can create as many derived classes with specific features to each derived class as needed.

8) What is Encapsulation? Binding the data in a single unit.

9) What is polymorphism? Polymorphism allows you define one interface and have multiple implementations. This is one of the basic principles of object oriented programming. Single from behaving differently in different situations. Overriding: The method overriding is an example of runtime polymorphism. You can have a method in subclass overrides the method in its super class with the same name and signature. (a) Must not change the argument list. (b) You cannot override a method marked final. (c) You cannot override a method marked static.

Page 2 of 29
Overriding Example: Class Animal{ Function whoAmI(){ echo Animal;}} Class Dog extends Animal{ Function whoAmI (){ echo Dog;}} Class Cow extends Animal{ Function whoAmI (){ echo Cow;}} Animal ref1 = new Animal(); Animal ref2 = new Dog(); Animal ref1 = new Cow(); Ref1. whoAmI(); Ref2. whoAmI(); Ref3. whoAmI();

Overloading: Method overloading means to have TWO or MORE methods with same name with different signature (arguments) in the same class different. (__get(),__set()) (a) (b) (c) (d) Overloaded methods MUST change the argument list. Overloaded methods can change the return type. Overloaded methods can change the access modifier A method can be overloaded in the same class or in a subclass.

Note: Can overloaded methods be override too? Yes . . . How do you prevent a method from being overridden? Use the final modifier. Overloading Example:

Class Overload{ Function test(int a){} Function test(int a,int b){} Function test(double a){} } Overload ref1 = new Overload(); ref1. Test(10); ref1. Test(10,20); ref1. Test(5.5);

10)What is final modifier? The final modifier keyword makes that the programmer cannot change the value anymore. The actual meaning depends on whether it is applied to a class, a variable, or method. Final keyword is used to prevent child class from overriding method of parent class. Final Classes A final class cannot have subclasses, final class cant extends. Final Variables - A final variable cannot be changed once it is initialized Final Methods A final method cannot be overridden by subclasses.

11)PHP supports multiple inheritance or multilevel inheritance?

Page 3 of 29
Support: Single level, hierarchical level, Multilevel Multiple and Hybrid it does not support. It does support multiple inheritance but through use of interface not directly Multiple inheritance: class derived from multiple classes at one time ( not supported by php ) Exp: Class A -> Class C <- Class C Multilevel inheritance : Class is inherited at multiple levels. Exp: Class A -> Class B -> Class C

12) What is object cloning? Making copy of object is nothing but object cloning e.g. $copy_of_object = clone $object;

13)What is the difference between abstract and interface? What are all the access specifiers for an interface and abstract?

Abstract Class For abstract class a method must be declared as abstract. It contains one or more abstract methods. Abstract methods dont have any implementation. The Abstract methods can declare with Access modifiers like public, protected. When implementing in subclass these methods must be defined with the same (or a less restricted) visibility. Abstract class can contain variables and concrete methods. A class can Inherit only one Abstract class and Multiple inheritances is not possible for Abstract class. An abstract class can never be Instantiated. Its sole purpose is to be extended. In case of abstract class, a class may extend only one abstract class An abstract class can have non-abstract methods An abstract class can have instance variables An abstract class can contain constructors.

Interface For interface all the methods by default are abstract methods only. Cannot declare variables or concrete methods in interfaces.

All methods declared in an interface must be public.

Interfaces cannot contain variables and concrete methods except constants. A class can implement many interfaces and Multiple interface inheritance is possible. You cant instantiate an interface directly. A class may implement several interfaces. All methods of an interface are abstract. An Interface cannot have instance Variables

5 6 7 8 9

An interface cannot contain constructor

Page 4 of 29

Public: can be accessed outside class by any child class protected: can be accessed in derived class having protected methods or variables not by other private: can be accessed by only members of class

14)What is constructor? i) ii) iii) iv) A constructer is a special method. It is special because its name is the same as the class name. They do not have return type. They cannot be inherited.

15)What is destructor?

16)When should I use abstract classes and when shiuld I use interfaces? Use Interfaces when. You see that something in your design will change frequently. If various implementations only share method signatures then it is better to use Interface. You need some classes to use some methods which you dont want to be included in the class, then you go for the interface, which makes it easy to just implement and makes use of the methods defined in the interface. Use Abstract class when If various implementations are of the same kind and use common behavior or status then abstract class is better to use. When you want to provide a generalized form of abstraction and level the implementation task with inheriting subclass. Abstract classes are an excellent way to create planed inheritance hierarchies. They are also a good choice for non-leaf classes in class hierarchies.

17)What is late static binding? Late static binding is one of the new features of PHP 5.3. static::static2() - This will perform runtime evaluation of statics.

Used for retrieving the caller class information when static call to inherited method is made, so theres no object available to carry the class info.

Page 5 of 29
To use late static binding, you need a class that inherits from another one and some static methods that are overridden. Take the following code: class ParentClass { public static function normalCall() { self::calledMethod(); } public static function lateStaticCall() { static::calledMethod(); } public static function calledMethod() { echo "Called in Parent\n"; } } class ChildClass extends ParentClass { public static function calledMethod() { echo "Called in Child\n"; } }

18)What are the magic methods in PHP? The function names __construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state() and __clone() are magical in PHP classes. You cannot have functions with these names in any of your classes unless you want the magic functionality associated with them. These are predefined methods, which are executed automatically when an object is initiated or method is called.

19)Why we use __Sleep? when serialize() and unserialize() are called, they will look for a __sleep() and __wakeup() function on the object they are working with respectively. when __sleep() is called, a logging object should save and close the file it was writing to, and when __wakeup() is called the object should reopen the file and carry on writing. Although __wakeup() need not return any value, __sleep() must return an array of the values you wish to have saved.

20)What is the use of __autoload? You may define an __autoload() function which is automatically called in case you are trying to use a class/interface which hasn't been defined yet. By calling this function the scripting engine is given a last chance to load the class before PHP fails with an error. Exception caching: it is possible , but by writing custom class

21)What is serialization? PHP serialize allows you to keep an array or object in a text form.

Page 6 of 29
serialize() returns a string containing a byte-stream representation of any value that can be stored in PHP. unserialize() can use this string to recreate the original variable values. Using serialize to save an object will save all variables in an object. The methods in an object will not be saved, only the name of the class.

22)What is static variable? How will access a static variable? What is static class? Static variable: Static method: Defining a Static Member: Defining Static Method: Accessing Static variable: Accessing static method: A data member that is commonly available, all object of a class is called a static member A static method is a class method that can be called without creating an instance of a class. Static public $variable_name; Static public function function_name(){} class_name::$variable_name; class_name::function_name();

Note: Static function can access only static properties of the class

23) What is static variable? What is the difference between static and non-static variables? Normally when a function terminates, all of its variables lose its values. Sometimes we want to hold these values for further job. Generally those variables which hold the values are called static variables inside a function. To do this we must write the keyword "static" in front of those variables.

24)Private methods cannot be Abstract? If a method is defined as abstract then it cannot be declared as private (it can only be public or protected). This is because a private method cannot be inherited.

25) What is design pattern? Singleton pattern? A design pattern is a general reusable solution to a commonly occurring problem in software design.

26)How can archive multiple inheritances in PHP?

27)Let us take a scenario a class with two properties has 2 objects, let us extend the class and access the parent variables. What happens if we compare the objects with (==) and (===)?

== true; === false

28)Let us take a scenario a class with two properties has 2 objects, let us extend the class and access the parent variables. What happens if we compare the objects with (==) and (===)? == false; === true

Page 7 of 29

29)How do you implement over loading? How many types it can be implemented?

Page 8 of 29 PHP:

1) What is the different between echo print statements? Echo can take multiple expressions, print cannot take multiple expressions. Echo has the slight performance advantage because it doesnt have a return value. Echo is a little bit faster. 2) Echo is a function or method? Both 3) What is the difference between variable and global variable? Global variable is you can access anywhere in the application 4) What is the use of ampersand in PHP? <?php $a = 1; $b = &$a; // $b references the same value as $a, currently 1 $b = $b + 1; // 1 is added to $b, which effects $a the same way echo "b is equal to $b, and a is equal to $a"; // b is equal to 2, and a is equal to 2 ?>

5) How to swap values in php? <?php $x = 10; $y = 20; $x = $x+$y; //30 $y= $x-$y; //30-20 $x=$x-$y; //30-10 echo $x,$y ; $x ^= $y; $y ^= $x; $x ^= $y; echo $x,$y ; $x = $y = $x = echo ?> $x*$y; $x / $y; $x / $y; $x,$y ;

6) In how many ways create constants in PHP? What are all the differences? define('MY_CONST', 'hello'); const MIN_VALUE = 0.0; // Works INSIDE of a class definition. Note: You can assign numeric and string value to constants 7) What are all cache types (Methods) in PHP?

Page 9 of 29

FileCache(Default): File cache is a simple cache that uses local files, it is the slowest cache engine, and doesnt provide as many features for atomic operations. However, since disk storage is often quite cheap, storing large objects, or elements that are infrequently written work well in files. ApcCache: APC cache uses the PHP APC extension This extension uses shared memory on the webserver to store objects. This makes it very fast, and able to provide atomic read/write features. By default CakePHP will use this cache engine if its available. Wincache: Wincache uses the Wincache extension. Wincache is similar to APC in features and performance, but optimized for windows and IIS. XcacheEngine: Similar to APC, Xcache is a PHP extension that provides similar features to APC. MemcacheEngine: Uses the Memcache extension. Memcache provides a very fast cache system that can be distributed across many servers, and provides atomic operations. RedisEngine: Uses the phpredis extension. Redis provides a fast and persistent cache system similar to memcached, also provides atomic operations.

8) How can you check `magic_quotes` On or Off? get_magic_quotes_gpc()

9) .htaccess commands? Php_flag Php_value deny from 000.000.000.000 allow from 000.000.000.000

10)What is namespace? Use? Namespace is grouping of related PHP code in an application or library. Namespace is a keyword using this keyword you can create name space. How do you use namespace - Use namespace

11)What is difference in double cotes () and single cotes () in PHP?

12)If you want to upload a single file in two different server then how can you do?

Page 10 of 29
13)What is the difference & similarity between session & cookie? If we will delete cookies then session will work or not?

14)How many way you can access cookies? $_COOKIE,$_REQUEST

15)How to create persistence cookie? Persistence cookie is a cookie which is stored permanently in the browser. You can create without mentioning expiry time.

16)What is an array? Ordering a data by accessing value to keys

17)What is indexed array? Array with numeric keys

18)What are array operators?

Example $a + $b $a == $b

Name Union Equality

$a === $b Identity $a != $b $a <> $b $a !== $b Inequality Inequality Non-identity

19)Array(1,2,3) + array(4,5,6)? Result? Answer: Array ( [0] => 1 [1] => 2 [2] => 3 ), Union

20)Php.ini setting flags? Ini_set(); a. set_time_limit b. max_execution_time c. upload_max_filesize

Page 11 of 29
21)Array Functions?

array_combine

Creates an array by using one array for keys and another for its values array array_combine ( array $keys , array $values )

array_count_values

Counts all the values of an array array array_count_values ( array $input )

array_diff

Computes the difference of arrays array array_diff ( array $array1 , array $array2 [, array $... ] )

array_merge

Merge one or more arrays array array_merge ( array $array1 [, array $... ] )

array_push

Push one or more elements onto the end of array int array_push ( array &$array , mixed $var [, mixed $... ] )

array_pop

Pop the element off the end of array mixed array_pop ( array &$array )

array_shift

Shift an element off the beginning of array mixed array_shift ( array &$array )

array_unshift

Prepend one or more elements to the beginning of an array int array_unshift ( array &$array , mixed $var [, mixed $... ] )

count

Count all elements in an array, or something in an object int count ( mixed $var [, int $mode = COUNT_NORMAL,COUNT_RECURSIVE ] )

sizeof

Alias of count

array_flip

Exchanges all keys with their associated values in an array array array_flip ( array $trans )

array_filter

Filters elements of an array using a callback function array array_filter ( array $input [, callable $callback = "" ] )

array_merge_recursive

Merge two or more arrays recursively array array_merge_recursive ( array $array1 [, array $... ] )

array_multisort

Sort multiple or multi-dimensional arrays bool array_multisort ( array &$arr [, mixed $arg = SORT_ASC [, mixed $arg = SORT_REGULAR [, mixed $... ]]] )

array_replace_recursive

Replaces elements from passed arrays into the first array recursively array array_replace_recursive ( array $array , array $array1 [, array $... ] )

Page 12 of 29

array_replace

Replaces elements from passed arrays into the first array array array_replace ( array $array , array $array1 [, array $... ] )

array_reverse

Return an array with elements in reverse order array array_reverse ( array $array [, bool $preserve_keys = false ] ) sort : Sort an array bool sort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) rsort : Sort an array in reverse order bool rsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) ksort : Sort an array by key bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) krsort : Sort an array by key in reverse order bool krsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) asort : Sort an array and maintain index association bool asort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) arsort : Sort an array in reverse order and maintain index association bool arsort ( array &$array [, int $sort_flags = SORT_REGULAR ] ) usort : Sort an array by values using a user-defined comparison function bool usort ( array &$array , callable $cmp_function ) uksort : Sort an array by keys using a user-defined comparison function bool uksort ( array &$array , callable $cmp_function ) uasort : Sort an array with a user-defined comparison function and maintain index association bool uasort ( array &$array , callable $cmp_function )

Sorting

22)String functions?

echo

Output one or more strings void echo ( string $arg1 [, string $... ] )

print

Output a string int print ( string $arg )

Printf

Output a formatted string int printf ( string $format [, mixed $args [, mixed $... ]] )

Sprint

Return a formatted string string sprintf ( string $format [, mixed $args [, mixed $... ]] )

Explode

Split a string by string array explode ( string $delimiter , string $string [, int $limit ] )

Implode

Join array elements with a string string implode ( string $glue , array $pieces )

Page 13 of 29

htmlentities

Convert all applicable characters to HTML entities string htmlentities ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = 'UTF-8' [, bool $double_encode = true ]]] )

htmlspecialchars

Convert special characters to HTML entities string htmlspecialchars ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = 'UTF-8' [, bool $double_encode = true ]]] )

html_entity_decode

Convert all HTML entities to their applicable characters string html_entity_decode ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = 'UTF-8' ]] )

trim

Strip whitespace (or other characters) from the beginning and end of a string string trim ( string $str [, string $charlist ] )

ltrim

Strip whitespace (or other characters) from the beginning of a string string ltrim ( string $str [, string $charlist ] )

Rtrim

Strip whitespace (or other characters) from the end of a string string rtrim ( string $str [, string $charlist ] )

nl2br

Inserts HTML line breaks before all newlines in a string string nl2br ( string $string [, bool $is_xhtml = true ] )

str_pad

Pad a string to a certain length with another string string str_pad ( string $input , int $pad_length [, string $pad_string = " " [, int $pad_type = STR_PAD_RIGHT ]] ) <?php $input = "Alien"; echo str_pad($input, echo str_pad($input, echo str_pad($input, echo str_pad($input, ?>

10); // produces "Alien " 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien" 10, "_", STR_PAD_BOTH); // produces "__Alien___" 6 , "___"); // produces "Alien_"

str_repeat Repeat a string string str_repeat ( string $input , int $multiplier ) <?php echo str_repeat("-=", 10); //-=-=-=-=-=-=-=-=-=-= ?>

str_replace

Replace all occurrences of the search string with the replacement string mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) $bodytag = str_replace("%body%", "black", "<body text='%body%'>");

str_shuffle

Randomly shuffles a string string str_shuffle ( string $str ) <?php

Page 14 of 29
$str = 'abcdef'; $shuffled = str_shuffle($str); // This will echo something like: bfdaec echo $shuffled; ?>

str_split

Convert a string to an array array str_split ( string $string [, int $split_length = 1 ] )

str_word_count

Return information about words used in a string mixed str_word_count ( string $string [, int $format = 0 [, string $charlist ]] )

Stripos

Find the position of the first occurrence of a case-insensitive substring in a string int stripos ( string $haystack , string $needle [, int $offset = 0 ] )

Stristr

Case-insensitive strstr() string stristr ( string $haystack , mixed $needle [, bool $before_needle = false ] )

Strlen

Get string length int strlen ( string $string )

Strrev

Reverse a string string strrev ( string $string )

Strrpos

Find the position of the last occurrence of a substring in a string int strrpos ( string $haystack , string $needle [, int $offset = 0 ] )

Strtolower

Make a string lowercase string strtolower ( string $str )

Strtoupper

Make a string uppercase string strtoupper ( string $string )

Substr

Return part of a string string substr ( string $string , int $start [, int $length ] ) <?php $rest = substr("abcdef", -1); // returns "f" $rest = substr("abcdef", -2); // returns "ef" $rest = substr("abcdef", -3, 1); // returns "d" ?>

substr_compare

Binary safe comparison of two strings from an offset, up to length characters int substr_compare ( string $main_str , string $str , int $offset [, int $length [, bool $case_insensitivity = false ]] ) echo substr_compare("abcde", "BC", 1, 2, true); // 0

substr_count

Count the number of substring occurrences int substr_count ( string $haystack , string $needle [, int $offset = 0 [, int $length ]] )

Page 15 of 29
echo substr_count($text, 'is', 3, 3);

substr_replace

Replace text within a portion of a string mixed substr_replace ( mixed $string , mixed $replacement , mixed $start [, mixed $length ] ) echo substr_replace($var, 'bob', 10, -1) . "<br />\n";

Ucfirst

Make a string's first character uppercase string ucfirst ( string $str )

Ucwords

Uppercase the first character of each word in a string string ucwords ( string $str )

Wordwrap

Wraps a string to a given number of characters string wordwrap ( string $str [, int $width = 75 [, string $break = "\n" [, bool $cut = false ]]] ) <?php $text = "A very long woooooooooooord."; $newtext = wordwrap($text, 8, "\n", true); echo "$newtext\n"; ?>

Quote string with slashes addslashes string addslashes ( string $str )

stripslashes

Un-quotes a quoted string string stripslashes ( string $str )

23)Session handling functions? a. Session_start(); b. Session_id(); c. session_destroy(); - Start new or resume existing session - Get and/or set the current session id - Destroys all data registered to a session

24)HTTP functions? Header( Content-type:application/pdf, application/word, text/html Content-disposition:attachment Location:http://www.example.com )

Page 16 of 29
25)Date functions?
strtotime Parse about any English textual datetime description into a UNIX timestamp strtotime () strtotime(D1)-strtotime(D2);

Mktime

Get UNIX timestamp for a date date(y M,mktime(0,0,0,$m,$d,$y));

checkdate

Validate a gregorian date bool checkdate ( int month, int day, int year)

date

Format a local time/date string date ( string format [, int timestamp])

getdate

Get date/time information array getdate ( [int timestamp]) <?php $today = getdate(); print_r($today); ?>

26)Image Functions? a. b. c. d. e. f. g. getimagesize(); image_type_to_extension(); imagesx(); imagesy(); imagepng(); imagecopymerge(); imagetypes(); Get the size of an image Get file extension for image type Get image width Get image height Output a PNG image to either the browser or a file Copy and merge part of an image Return the image types supported by this PHP build

27)Regular Expression Functions?


Perform a regular expression match preg_match Searches subject for a match to the regular expression given in pattern. int preg_match ( string pattern, string subject [, array matches [, int flags]])

preg_replace

Perform a regular expression search and replace mixed preg_replace ( mixed pattern, mixed replacement, mixed subject [, int limit])

preg_split

Split string by a regular expression array preg_split ( string pattern, string subject [, int limit [, int flags]])

Email regular expression: Eregi(^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$,$email);

Page 17 of 29
28)FTP functions?
ftp_login Logs in to an FTP connection bool ftp_login ( resource ftp_stream, string username, string password)

ftp_connect

Opens an FTP connection resource ftp_connect ( string host [, int port [, int timeout]])

ftp_close

Closes an FTP connection void ftp_close ( resource ftp_stream)

ftp_put

Uploads from an open file to the FTP server bool ftp_fput ( resource ftp_stream, string remote_file, resource handle, int mode [, int startpos])

ftp_mkdir

Creates a directory string ftp_mkdir ( resource ftp_stream, string directory)

29)Can you tell me what the operators available in PHP?

Example $a == $b Equal

Name

$a === $b Identical $a != $b $a <> $b $a !== $b $a < $b $a > $b $a <= $b $a >= $b Not equal Not equal Not identical Less than Greater than Less than or equal to Greater than or equal to

30)What is session_set_save_handler in php? Session_set_save_handler() set the user-level session storage functions which are used for storing and retrieving data associated with a session. This is most useful when a storage method other then those supplied by PHP session is preferred. Ie. Storing the session data in a local database. Session.gc_maxlifetime Session.gc_probability Session.gc_divisor 1440 seconds or 24 minutes 1 100

Page 18 of 29
31)How to do session using DB? Bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, Callback $destroy, callback $gc); Bool session_set_save_handler(array(&$this,open), array(&$this, close), array(&$this, read), array(&$this, write), array(&$this, destroy), array(&$this, gc));

32)Default session save path? How to change? Default session save path id temporary folder/tmp

33) how to increase session time in PHP ? In php.ini by setting session.gc_maxlifetime and session.cookie_lifetime values we can change the session time in PHP.

34)PHP how to know user has read the mail? $this->_header .= Disposition-Notification-To`.Email_address

35)How to know extension is loaded or not? Bool extension_loaded ( String $name) Find out whether an extension is loaded

36) Types of error? how to set error settings at run time? Three basic types of runtime errors in PHP: 1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all although you can change this default behaviour. 2. Warnings: These are more serious errors for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination. 3. Fatal errors: These are critical errors for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP?s default behaviour is to display them to the user when they take place. by using ini_set function. $currentTimeoutInSecs = ini_get(session.gc_maxlifetime);

Page 19 of 29
37)Error reporting Levels? Set_exception_handler(); Error_reporting(E_ERROR | E_WRONING | E_PARSE); Error_reporting(E_ALL^E_NOTICE);

E_NOTICE: Notices are not printed by default, and indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script. For example, trying to access the value of a variable which has not been set, or calling stat() on a file that doesn't exist. E_WARNING: Warnings are printed by default, but do not interrupt script execution. These indicate a problem that should have been trapped by the script before the call was made. For example, calling ereg() with an invalid regular expression. E_ERROR: Errors are also printed by default, and execution of the script is halted after the function returns. These indicate errors that can not be recovered from, such as a memory allocation problem. E_PARSE: Parse errors should only be generated by the parser. The code is listed here only for the sake of completeness. E_CORE_ERROR: This is like an E_ERROR, except it is generated by the core of PHP. Functions should not generate this type of error. E_CORE_WARNING: This is like an E_WARNING, except it is generated by the core of PHP. Functions should not generate this type of error. E_COMPILE_ERROR: This is like an E_ERROR, except it is generated by the Zend Scripting Engine. Functions should not generate this type of error. E_COMPILE_WARNING: This is like an E_WARNING, except it is generated by the Zend Scripting Engine. Functions should not generate this type of error. E_USER_ERROR: This is like an E_ERROR, except it is generated in PHP code by using the PHP function trigger_error(). Functions should not generate this type of error. E_USER_WARNING: This is like an E_WARNING, except it is generated by using the PHP function trigger_error(). Functions should not generate this type of error. E_USER_NOTICE: This is like an E_NOTICE, except it is generated by using the PHP function trigger_error(). Functions should not generate this type of error. E_ALL: All of the above. Using this error_reporting level will show all error types.

38) what is cross site scripting? SQL injection?

39) what is MVC? why its been used? Model-view-controller (MVC) is an architectural pattern used in software engineering.

Page 20 of 29
40) what is CURL? CURL means Client URL Library curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos), file transfer resume, proxy tunneling and a busload of other useful tricks.

41) HOW we can transfer files from one server to another server without web forms? using CURL we can transfer files from one server to another server. ex:Uploading file <?php /* http://localhost/upload.php: print_r($_POST); print_r($_FILES); */ $ch = curl_init(); $data = array(name => Foo, file => @/home/user/test.png); curl_setopt($ch, CURLOPT_URL, http://localhost/upload.php); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); ?> output: Array ( [name] => Foo ) Array ( [file] => Array ( [name] => test.png [type] => image/png [tmp_name] => /tmp/phpcpjNeQ [error] => 0 [size] => 279 ))

42) How can I set a cron and how can I execute it in Unix, Linux, and windows? Cron is very simply a Linux module that allows you to run commands at predetermined times or intervals. In Windows, its called Scheduled Tasks.

43)What is the difference between include and require in PHP? Include:

Require:

44) Apache configuration file? Apache folder httpd.cofg

Page 21 of 29
45) $_SERVER? $_SERVER[REQUEST_URI]; $_SERVER[SCRIPT_NAME]; $_SERVER[HTTP REFERER];

46)If you want to include external library? How do you do it?

47)What is the default extension in PHP? ARRAY, CLASS, OBJECTS, Date, string?

48)How do you add two numbers without using arithmetic operators?

49)What is the use of LEFT Shift and RIGHT Shift operators in PHP?

Page 22 of 29 MYSQL:

1) What are all the Index types supports the InnoDb and MyISM engines? a. The big difference between MySQL Table Type MyISAM and InnoDB is that InnoDB supports transaction

b. InnoDB supports some newer features: Transactions, row-level locking, foreign keys c. InnoDB is for high volume, high performance

d. use MyISAM if they need speed and InnoDB for data integrity. e. f. InnoDB has been designed for maximum performance when processing large data volumes Even though MyISAM is faster than InnoDB

g. InnoDB supports transaction. You can commit and rollback with InnoDB but with MyISAM once you issue a command its done h. MyISAM does not support foreign keys where as InnoDB supports i. Fully integrated with MySQL Server, the InnoDB storage engine maintains its own buffer pool for caching data and indexes in main memory. InnoDB stores its tables and indexes in a tablespace, which may consist of several files (or raw disk partitions). This is different from, for example, MyISAM tables where each table is stored using separate files. InnoDB tables can be of any size even on operating systems where file size is limited to 2GB.

2) What is the cruster Index? What are the DB Engines supports cruster index in MySQL?

3) What is difference in BTREE Index and hash Index in MySQL? BTREE index search from left to right. Hash index is search after encrypt

4) How do you handle exceptions in MySQL SP?

5) What is multi-threading in MySQL?

Page 23 of 29
6) What are all cache types in MySQL?

7) What is difference between view and Table?

8) What is the importance of SP in MySQL?

9) What is Difference between SP and function in MySQL?

10) In what Scenarios write Triggers?

11)What is the difference between unique and primary key? Unique: allows one null value Primary: null value not allowed

12) what is outerjoin? inner join?

13)How to union?

14)EXTRACT use in mysql? Select * from TableName where EXTRACT(year from fieldname)=2009;

15)MYSQL functions?

Page 24 of 29
SELECT DATEDIFF(D1,D2); SELECT CURDATE(); SELECT CURTIME(); SELECT FOUND_ROWS(); DESCRIBE table_name; AES_ENCRYPT(str,str_key) AEC_DECRYPT(crypt_str,key_str);

Page 25 of 29 JAVASCRIPT and AJAX:

1) What is the full form of AJAX? What is the difference status of AJAX? Property Description

onreadystatechange Stores a function to be called automatically each time the readyState property changes readyState Holds the status of the XMLHttpRequest. Changes from 0 to 4: 0: request not initialized 1: server connection established 2: request received 3: processing request 4: request finished and response is ready 200: "OK" 404: Page not found

status

2) How can you we know the length of all the input fields in a form?

3) How can I select an option of a select box dynamically?

4) After opening a popup window if I want to refresh the parent window on closing of the pop-up window then what shall id do?

5) What is the difference between Jquery and Ajax? Jquery Ajax not all handle ready states

Page 26 of 29 ZEND FRAMWORK:

1) Can you explain Zend architecture?

2) Zend Advantages and disadvantages? Advantages: 1. a variety of library is very powerful, including not only is a PHP framework, it is a big class library which is its main feature; 2. the framework itself uses a lot of design patterns to write, very elegant structure, the efficiency of medium; 3. Loosely coupled: The Zend Framework can be used as a component library. Meaning you can choose to use only one or a subset of components available within the framework. If you wish to use only Zend_Pdf you are free to do so without using other components of the framework. 4. with routing capability, 5. more powerful configuration file (to handle XML and php INI) 6. to support intuitive operation in addition to the database outside of the Model layer (stronger than CodeIgniter and CakePHP ), and can very easily loaded using the Loader functions of other newly added Class; 7. Cache feature is very powerful, from the front to the back-end Cache Cache support, back-end Cache support Memcache, APC, SQLite, files, etc. methods; database operations very powerful, supporting a variety of drivers (adapters) Disadvantages: 1. MVC feature complete weak, View layer simple to achieve (with no realization of the same), not very strong control of the front page 2. there is no automated scripts, create an application, including the import file, all have their own hand-built, entry costs are high 3. Zend Framework application framework as a medium is not, and can barely as large PHP application framework.

3) Which framework you suggested? Why? ZEND Framework, DB level restrictions

Page 27 of 29
4) How your request is filter in ZEND?

5) How do you create foreign key relation in ZEND Db Tables?

6) Can you call controller anywhere in the application? No

7) How can you call one method in another action? $this->method_name();

8) How to change URL in zend Framework? Using Router

9) How to write web service in zend Framework?

10)Can you call helper anywhere in the application? Yes

11)How to call bootstrap variable? Zend_conf_ini

12)Can you create SP using PHPMyAdmin? No

13)Why all frameworks have .htaccess, except Zend framework?

Page 28 of 29

JOOMLA EXTENSION TYPES:


1) Component : a. can be considered as mini application each component is driven by a menu and each menu item runs a component b. each component has two parts : back end (that allows you to configure and manage its content) and a front end (that display you information in the selected ways) 2) Module: a. Module are more lightweight extension that display information on your website b. Modules can display information even if they are not attached to a component. Actually they can display everything from a static HTML to complex slide show 3) Plug-in 4) Templates 5) languages

Page 29 of 29

ROUGH:
6) Can an Interface be abstract? How? 7) How can achieve multiple inheritances in PHP? 8) What is photo type key word in JavaScript? 9) Private methods cannot be Abstract? If a method is defined as abstract then it cannot be declared as private (it can only be public or protected). This is because a private method cannot be inherited.

10) nowdoc

http://www.allinterview.com/showanswers/74503.html
http://techpreparation.com/computer-interview-questions/mysql-interview-questions-answers2.htm prototype is an object from which other objects inherits. http://msdn.microsoft.com/en-us/library/scsyfw1d%28v=vs.71%29.aspx http://www.devshed.com/c/a/MySQL/Error-Handling/ http://www.wsdstaff.net/~kmurphy/vb/global.htm

Anda mungkin juga menyukai