General Flashcards
When require() fails, what is the difference between require() and include() function calls?
require is identical to include() except upon failure it will also produce a fatal E_COMPILE_ERROR level error. In other words, it will halt the script whereas include() only emits a warning (E_WARNING) which allows the script to continue.
What are the list of keywords in php 5 ?
Abstract,and,array,as,break,case,catch,class,clone,const,continue,declare,default,do,else,else if,end declare,end for,endof reach,endif,endswitch,end while,extends,final,for,for each,function,global,goto,if,implements,interface,instanceof,namespace,new,or,private,protected,public,static,switch,throw,try,use,var,while,xor
What is the difference between require_once() and require() functions?
The require_once statement is identical to require() except PHP will check if the file has already been included, and if so, not include (require) it again.
See the include_once() documentation for information about the _once behaviour, and how it differs from its non _once siblings.
What is session_decode for?
session_decode — Decodes session data from a session encoded string
Description
bool session_decode ( string $data ) session_decode() decodes the serialized session data provided in $data, and populates the $_SESSION superglobal with the result.
Please note the unserialization method is not the same as unserialize(). The serialization method is internal to PHP and can be set using session.serialize_handler.
What is the alias of session_commit ?
This function is an alias of: session_write_close().
What is session _start used for?
session_start — Start new or resume existing session
bool session_start ( void ) session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.
What is class naming convention?
Use of upper camel naming- first letter of each word is capitalised.
Camel case naming apply to properties.
What is use of .inc in class name? E.g Address.inc
it used to indicate that it intends to be inclusion and not executed on its own.
In best practices how would you write properties
Best practices suggest avoid naming public property with underscore as it is generally imply private property
What is the difference between “==” and “===” operators?
The “==” is used to check properties
While “===” s used to check properties and compare instances if they belong to same class
In overriding what are general rules of inheriting properties?
Overriding method must not be stricter than the parent
The method must have same signature and number of arguments parameters, except for constructors which can have more or less args.
You cannot override constants of interface
How do you reference or call on superclass property?
Use parent key word to reference superclass properties
What are features of abstract class?
They cannot be instantiated
If abstract class has abstract methods these methods must be declared in subclass
Abstract class are implicitly public
If you extend a abstract class the subclass can not have properties stricter than its parent class.
You cannot extend more than once