PHP Questions

Q:

What is the use of super-global arrays in PHP?

Answer

Super global arrays are the built in arrays that can be used anywhere. They are also called as auto-global as they can be used inside a function as well. The arrays with the longs names such as $HTTP_SERVER_VARS, must be made global before they can be used in an array. This $HTTP_SERVER_VARS check your php.ini setting for long arrays.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1999
Q:

What is a PHP Filter?

Answer

A PHP filter is used to validate and filter data coming from insecure sources.
To test, validate and filter user input or custom data is an important part of any web application.
The PHP filter extension is designed to make data filtering easier and quicker.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1998
Q:

What is Constructors and Destructors?

Answer

CONSTRUCTOR : PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.

DESTRUCTORS : PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1968
Q:

What is PHP?

Answer

PHP: Hypertext Preprocessor is open source server-side scripting language that is widely used for web development. PHP scripts are executed on the server. PHP allows writing dynamically generated web pages efficiently and quickly. The syntax is mostly borrowed from C, Java and perl. PHP is free to download and use.


 

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1958
Q:

What’s the difference between htmlentities() and htmlspecialchars()?

Answer

Htmlentities() converts all applicable characters to HTML entities. While htmlspecialcharacter()converts special characters to HTML entities. This means htmlentities( ) will check for non English language characters, such as French accents, the German umlaut, etc.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

3 1950
Q:

What are the differences between GET and POST methods in form submitting?

Answer

On the server side, the main difference between GET and POST is where the submitted is stored. The $_GET array stores data submitted by the GET method. The $_POST array stores data submitted by the POST method.

On the browser side, the difference is that data submitted by the GET method will be displayed in the browser’s address field. Data submitted by the POST method will not be displayed anywhere on the browser.

GET method is mostly used for submitting a small amount and less sensitive data.
POST method is mostly used for submitting a large amount or sensitive data.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1928
Q:

Echo vs print statement

Answer

echo() and print() are language constructs in PHP, both are used to output strings. The speed of both statements is almost the same.


echo() can take multiple expressions whereas print cannot take multiple expressions.


Print return true or false based on success or failure whereas echo doesn't return true or false.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1907
Q:

How to set cookies in PHP?

Answer

The function setcookie() is used to define a cookie that is to be sent along with HTTP headers. The cookie must be sent prior to any output from the script as is the protocol restriction. After setting the cookies, they can be used when the next page is loaded by using $_COOKIE or $HTTP_COOKIE_VARS arrays.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1904