Section 1

Preview this deck

What is the difference between GET and POST?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (14)

Section 1

(14 cards)

What is the difference between GET and POST?

Front

GET displays the submitted data as part of the URL, during POST this information is not shown as it's encoded in the request. GET can handle a maximum of 2048 characters, POST has no such restrictions. GET allows only ASCII data, POST has no restrictions, binary data are also allowed. Normally GET is used to retrieve data while POST to insert and update

Back

What is the output of the following code: $a = '1'; $b = &$a; $b = "2$b"; echo $a.", ".$b;

Front

Back

Front

Back

What's the difference between the include() and require() functions?

Front

They both include a specific file but on require the process exits with a fatal error if the file can't be included, while include statement may still pass and jump to the next step in the execution.

Back

What are the __construct() and __destruct() methods in a PHP class?

Front

All objects in PHP have Constructor and Destructor methods built-in. The Constructor method is called immediately after a new instance of the class is being created, and it's used to initialize class properties. The Destructor method takes no parameters. Understanding these two in PHP means that the candidate knows the very basics of OOP in PHP.

Back

Can the value of a constant change during the script's execution?

Front

No, the value of a constant cannot be changed once it's declared during the PHP execution

Back

The value of the variable input is a string 1,2,3,4,5,6,7. How would you get the sum of the integers contained inside input?

Front

Back

How can you enable error reporting in PHP?

Front

Check if "display_errors" is equal "on" in the php.ini or declare "ini_set('display_errors', 1)" in your script. Then, include "error_reporting(E_ALL)" in your code to display all types of error messages during the script execution. Enabling error messages is very important especially during the debugging process as one can instantly get the exact line that is producing the error and can see also if the script in general is behaving correctly.

Back

Can you extend a Final defined class?

Front

No, you cannot extend a Final defined class. A Final class or method declaration prevents child class or method overriding

Back

What's the difference between unset() and unlink()

Front

unset() sets a variable to "undefined" while unlink() deletes a file we pass to it from the file system.

Back

How we can get the number of elements in an array?

Front

The count() function is used to return the number of elements in an array.

Back

What are Traits?

Front

Traits are a mechanism that allows you to create reusable code in languages like PHP where multiple inheritance is not supported. A Trait cannot be instantiated on its own. It's important that a developer knows the powerful features of the language (s)he is working on, and Trait is one of such features

Back

How can we get the IP address of the client?

Front

$_SERVER["REMOTE_ADDR"];

Back

What are the main error types in PHP and how do they differ?

Front

In PHP there are three main type of errors: Notices - Simple, non-critical errors that are occurred during the script execution. An example of a Notice would be accessing an undefined variable. Warnings - more important errors than Notices, however the scripts continue the execution. An example would be include() a file that does not exist. Fatal - this type of error causes a termination of the script execution when it occurs. An example of a Fatal error would be accessing a property of a non-existent object or require() a non-existent file.

Back