Interview Question for PHP

php interview question and answer

These are some Interview question for PHP given below:-

1)What’s PHP?

PHP is a net language supported scripts that enable developers to dynamically produce generated sites.

2) What is the full form of PHP?

PHP stands for Hypertext Pre-processor.

3) That programming language will PHP resemble?

PHP syntax resembles Perl and C

4) Are multiple inheritances supported in PHP?

PHP supports solely single inheritance; it means category|a category} may be extended from only 1 single class victimization the keyword ‘extended’.

5) what’s that means of a final category and a final method?

‘final’ is introduced in PHP5. Final category means this category can’t be extended and a final technique can’t be overridden.

6) However, is that the comparison of objects wiped out PHP?

We use the operator ‘==’ to check is 2 objects are instanced from identical category and have the same attributes and equal values. {we can|wewill|we are able to} check if 2 objects are pertaining to an identical instance of an identical category by the utilization of the identity element ‘===’.

7) However, will PHP and markup language interact?

It is doable to get markup language through PHP scripts, and it’s doable to pass items of knowledge from markup language to PHP.

8) What form of operation is required once passing values through a kind or Associate in Nursing URL?

If we’d wish to pass values through a kind or Associate in Nursing universal resource locator, then we want to write in code and to rewrite them victimization htmlspecialchars() and urlencode().

9) However, will PHP and Javascript interact?

PHP and Javascript cannot directly act since PHP may be a server aspect language and Javascript may be a client-side language. However, {we will|wewill|we are able to} exchange variables since PHP can generate Javascript code to be dead by the browser and it’s doable to pass specific variables back to PHP via the universal resource locator.

10) What’s required to be able to use the image function?

GD library is required to execute image functions.

11) what’s the utilization of the perform ‘image types()’?

imagetypes() offers the image format and kinds supported by this version of GD-PHP.

12) What are the functions to be accustomed get the image’s properties (size, width, and height)?

The functions ar getimagesize() for size, imagesx() for dimension and imagesy() for height.

13) however failures in execution are handled with include() and require() functions?

If they perform require() cannot access the file then it ends with a fatal error. However, the include() perform offers a warning, and therefore the PHP script continues to execute.
14) however is it doable to line Associate in Nursing infinite execution time for PHP script?

The set_time_limit(0) further at the start of a script sets to infinite the time of execution to not have the PHP error ‘maximum execution time exceeded.’ it’s conjointly doable to specify this within the php.ini file.

15) What will the PHP error ‘Parse error in PHP – sudden T_variable at line x’ means?

This is a PHP programming error expressing that a slip at the road x stops parsing and corporal punishment the program.

16) What ought to we have a tendency to do to be able to export information into Associate in Nursing stand outfile?

The most common and used means is to urge information into a format supported by stand out. for instance, its doable to jot down a .csv file, to settle on for instance comma as a setup between fields and so to open the file with stand out.

17) what’s the perform file_get_contents() helpful for?

file_get_contents() lets reading a file and storing it during a string variable.

18) however will we have a tendency to hook up with MySQL information from a PHP script?

To be able to hook up with a MySQL information, we have a tendency to should use mysqli_connect() perform as follows:

<!–?php $database = mysqli_connect(“HOST”, “USER_NAME”, “PASSWORD”); mysqli_select_db($database,”DATABASE_NAME”); ?–>
19) what’s the perform mysql_pconnect() helpful for?

mysql_pconnect() guarantee a persistent association to the information, it means the association doesn’t shot once the PHP script ends.

This performance isn’t supported in PHP seven.0 and higher than

20) However, be the result set of Mysql handled in PHP?

The result set may be handled victimization mysqli_fetch_array, mysqli_fetch_assoc, mysqli_fetch_object or mysqli_fetch_row.

21) However is it doable to grasp the number of rows came back within the result set?

The perform mysqli_num_rows() returns the number of rows during a result set.

22) That perform offers the USA the number of affected entries by a query?

mysqli_affected_rows() come to the number of entries plagued by Associate in Nursing SQL question.

23) What’s the distinction between mysqli_fetch_object() and mysqli_fetch_array()?

The mysqli_fetch_object() perform collects the primary single matching record wherever mysqli_fetch_array() collects all matching records from the table in Associate in Nursing array.

24) What will the unset() perform mean?

The unset() perform is devoted to variable management. it’ll create a variable undefined.

25) however do I escape information before storing it within the database?

The addslashes perform allows the USA to flee information before storage into the information.

26) however is it doable to get rid of escape characters from a string?

The strip slashes perform allows the USA to get rid of the escape characters before apostrophes during a string.

27) however will we have a tendency to mechanically escape incoming data?

We have to change the Magic quotes entry within the configuration file of PHP.

28) What will the perform get_magic_quotes_gpc() means?

The perform get_magic_quotes_gpc() tells the USA whether or not the magic quotes is switched on or no.

29) Is it doable to get rid of the markup language tags from data?

The strip_tags() perform allows the USA to wash a string from the markup language tags.

30)What is the distinction between getting and POST?

GET displays the submitted knowledge as a part of the uniform resource locator, throughout POST this info isn’t shown as it’s encoded within the request.
GET will handle most of 2048 characters, POST has no such restrictions.
GET permits solely American Standard Code for Information Interchange knowledge, POST has no restrictions, binary knowledge are allowed.
Normally GET is employed to retrieve knowledge whereas POST to insert and update

basicittopic

basicittopic

A Computer Science Study for IT students and people of IT community

Leave a Reply

shares