General Flashcards

0
Q

When require() fails, what is the difference between require() and include() function calls?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

What are the list of keywords in php 5 ?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the difference between require_once() and require() functions?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is session_decode for?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the alias of session_commit ?

A

This function is an alias of: session_write_close().

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is session _start used for?

A

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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is class naming convention?

A

Use of upper camel naming- first letter of each word is capitalised.
Camel case naming apply to properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
What is use of .inc in class name?
E.g Address.inc
A

it used to indicate that it intends to be inclusion and not executed on its own.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In best practices how would you write properties

A

Best practices suggest avoid naming public property with underscore as it is generally imply private property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between “==” and “===” operators?

A

The “==” is used to check properties

While “===” s used to check properties and compare instances if they belong to same class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In overriding what are general rules of inheriting properties?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you reference or call on superclass property?

A

Use parent key word to reference superclass properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are features of abstract class?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly