Showing posts with label intermediate. Show all posts
Showing posts with label intermediate. Show all posts

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

what is inheritance in php?

Question:

what is inheritance in php give me an example?

Answer:

Inheritance permits the implementation of additional functionality in similar objects without the need to reimplement all of the shared functionality.

To inherit an another class we have to use extends Keyword

Example:

class phpInterview{
public fuction result(){
echo 'got selected';
}
}

//extending the above class

class questions extends phpInterview{
public function askedQuestions{
echo 'questions mostly from allphpinterviewquestions.blogspot.com ';
}
}

$obj=new questions();
echo $obj-> askedQuestions();
echo $obj->result();

The output is
questions mostly from allphpinterviewquestions.blogspot.com got selected

How will you check whether a class already defined or not?

Answer

Php has built-in function to check whether a class exists or not

The function is

class_exists()

Disadvantages of PHP?

Answer

1. It is a loosely typed language.
2. Multi threading is possible
3. PHP lacks in performance while comparing with java.(thats why very big applications are desinged using java)
4. It lacks in security.

Advantages of PHP

Answer

1. Good performance.
2. High scalability , reliability.(Ex. facebook uses php)
3. Easy to learn
4. High speed development
5. Availability of frameworks
6.Lot of Content management systems
7. It is a open source
8. It supports most of the operating systems(windows,linux,solaris etc)
9. PHP supports most of the databases(mysql,oracle,postgresql etc..)
10. Even support java classes.

Saturday, April 3, 2010

Question:what is References in php

Question: what is References in php

Answer

Access the same variable content by different names

Example
---------
$x =& $y;
?>
Here the $x,$y point the same content


List of Predefined Variables in php

Answer
======

$GLOBALS
$_SERVER
$_GET
$_POST
$_FILES
$_REQUEST
$_SESSION
$_ENV
$_COOKIE
$php_errormsg
$HTTP_RAW_POST_DATA
$http_response_header
$argc
$argv

Friday, April 2, 2010

number of days between two given dates using PHP?

Answer

$date1 = date('Y-m-d');
$date2 = '2006-07-01';
$days = (strtotime() - strtotime()) / (60 * 60 * 24);
echo "Number of days since '2006-07-01': $days";

What are the necessary security settings can be done to protect our application from hackers

It is not a simple question.

Need to consider more factors

Answer

The basic securtiy settings can be as follows

register_globals off in php.ini

disable the exec,passthrough,shell_exec like function

Install mod_security apache module

=======================

Friends if you know anything meeans please make a comment

This will be helpful for php interview questions blog visitors