Priti's Technical Corner

January 11, 2009

PHP Interview Question

Filed under: PHP — Tags: , , , , — pritisolanki @ 1:17 pm

Question 1: explain some magic methods.

Answer 1:
__sleep() : __sleep() is a magic method which is used to do some task related with pending data or clean task .It is always called before serialize() function.

__wakup() : __wakeup() method help  to reconstruct any resources that the object may have. It is called before unserialize().

Question 2: explain final keyword.

Answer 2: If a class is defined as final then this class can’t be extended where as if a method is final the child class can’t override the definition.

Question 3: Explain something abut open_basedir().

Answer 3:  It is used to restrict the files that can be opened by PHP to the specific directory-tree. This setting is mostly effective in shared server environment to limit the access one user to read files from another user.

Question 4:What is the function name to delete the file in PHP?.

Answer 4: unlink().

Question 5: What is the difference between fgets() and fgetss().

Answer 5:

fgets()- It will read file line – by -line.

fgetss — Gets line from file pointer and strip HTML tags.

Advertisements

2 Comments »

  1. please Help me frnz.. problem in uploading image
    I hav to resize and upload images using simple form
    every thing is working good in my Local Server(xampp)

    but i cannot upload the images into server in remote host
    using the same file…

    but im posting the code only to Upload image but not to resize.

    file name: upload.php
    —————————–

    Upload page
    Image Uploader

    Please upload an image

    Choose file to send: and

    Yum, Yum. I enjoyed that

    Copyright, etc

    please help me… thanks in Advance

    Comment by sriram — July 22, 2009 @ 6:44 am

  2. please Help me frnz.. problem in uploading image
    I hav to resize and upload images using simple form
    every thing is working good in my Local Server(xampp)

    but i cannot upload the images into server in remote host
    using the same file…

    but im posting the code only to Upload image but not to resize.

    file name: upload.php
    —————————–
    /*

    Upload page
    Image Uploader

    Please upload an image

    Choose file to send: and

    Yum, Yum. I enjoyed that

    Copyright, etc

    */
    please help me… thanks in Advance

    Comment by sriram — July 22, 2009 @ 6:46 am


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: