Priti's Technical Corner

September 29, 2008

PHP Interview Question

Filed under: Uncategorized — Tags: , , , — pritisolanki @ 4:53 pm

Following are some of the questions faced by me in an interview:

Question. Can you manipulate Images in PHP?
Answer:Yes

Question: How to reset cookies in php
Answer: unset($_COOKIE[‘key’]) and set_cookie(‘key’,’value’,expire)

Question:What is joomla
Answers:Joomla is a content management system which helps a novice user to set up and maintain his/her site with no developers intervention.

Question:How to extend classes for Multiple inheritance?
Answer:In PHP we don’t have Multiple inheritance.

Question:Explain the concept of inheritance.
Answer:Inheritance in OOP concept where in child inherit the property and methods from parent classe .It simplify and reduce instances of redundant code.

Question:How to track the bugs in your application.
Answer:We use bug-tracking tools like Mantis,Bugzilla etc.

Question:What is CVS.
Answer:CVS is concurrent version system which is use to maintain the versioning of files among the developers i,e it keeps track of all changes made by different developers and allow them to collaborate in development.

Question:how to sort array based on key and value.
Answer:

asort for value sorting
ksort for key based sorting.

Question:Maximum size of Mysql database.
Answer:It depend on constraint over file size in operating system.Usually its 4TB(TB=Terabyte).

Advertisements

2 Comments »

  1. thanx. very helpfull.. post if you have more…

    Comment by hmvrulz — October 4, 2008 @ 3:14 pm

  2. For implementing multiple inheritance we can do something like this :

    works in php5+:
    <?php
    class addition
    {
    static function add($a, $b)
    {
    echo $a . ‘ + ‘ . $b . ‘ = ‘ . ($a+$b);
    echo ”;
    }
    }

    class subtraction
    {
    static function subtract($a, $b)
    {
    echo $a . ‘ – ‘ . $b . ‘ = ‘ . ($a-$b);
    echo ”;
    }
    }

    class simpleMath
    {
    private $_parents = array();
    function __construct()
    {
    $this->_parents[] = ‘addition’;
    $this->_parents[] = ‘subtraction’;
    }
    function __call($method, $args)
    {
    foreach ($this->_parents as $class)
    {
    if (method_exists($class, $method)) {
    return call_user_func_array(array($class,$method),$args);
    }
    }
    }
    }

    $math = new simpleMath;

    $math->subtract(10, 4);
    $math->add(5, 2);

    ?>

    Comment by Anant Singh — December 16, 2008 @ 12:01 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: