PHP Interview Questions & Answers part 3

0
533
Q: – What is PHP ?

PHP is a language that has outgrown its name. It was originally conceived as a set of macros to help coders maintain personal home pages, and its name grew from its purpose. Since then, PHP's capabilities have been extended, taking it beyond a set of utilities to a full-featured programming language, capable of managing huge database-driven online environments.

Q: – What functions are used to draw a polygon and a filled polygon?

ImagePolygon() and ImageFilledPolygon()

Q: – Name three types of data relationships.

One-to-one, one-to-many, many-to-many

Q: – How can you read data from a process after you have opened a connection? What about writing data?

You can read and write to and from a process just as you can with an open file, namely with feof() and fgets() for reading and fputs() for writing.

Q: – How can you escape user input to make it a little safer before passing it to a shell command?

If user input is part of your shell command, you can use the escapeshellcmd() or escapeshellarg() functions to properly escape it.

Q: – Name a new feature introduced with PHP 5.

PHP 5 introduces (among other things) SQLite support, improved XML support, and a significantly improved object model.

Q: – Because many-to-many relationships are difficult to represent in an efficient database design, what should you do?

Create a series of one-to-many relationships using intermediary mapping tables.

Q: – Why can it be useful to know the type of data a variable holds?

Often the data type of a variable constrains what you can do with it. You might want to ensure that a variable contains an integer or a double before using it in a mathematical calculation, for example.

Q: – How do you create a new, blank canvas that is 300 pixels wide and 200 pixels tall?

$new_image = ImageCreate(300,200);

Submitted By:-Payal Gupta            Email-ID: – payalgupta1325@yahool.com

SHARE

LEAVE A REPLY