Which one of the following is the right way to invoke a method?
A. $object->methodName[];
B. object->methodName[];
C. object::methodName[];
D. $object::methodName[];
Answer: Option A
Click here to read 1000+ Related Questions on Object Oriented Concept[PHP]
PHP: Hypertext Preprocessor
- Open-source, server-side scripting language
- Used to generate dynamic web-pages
- PHP scripts reside between reserved PHP tags
- This allows the programmer to embed PHP scripts within HTML pages.
- It is interpreted language, scripts are parsed at run-time rather than compiled beforehand.
- Executed on the server-side.
- Source-code not visible by the client.
- -’ View Source’ in browsers does not display the PHP code.
- Various built-in functions allow for fast development.
- Compatible with many popular databases
- Supports procedural and object-oriented paradigm.
- All PHP statements end with a semi-colon.
- Each PHP script must be enclosed in the reserved PHP tag.
Variables in PHP:
- PHP variables must begin with a “$” sign.
- Case-sensitive[$Res != $res != $rEs]
- Globally
and locally scoped variables
- Global variables can be used anywhere.
- Local variables are restricted to a function or class.
- Certain variabe names reserved by PHP
- Form variables[$_POST, $_GET]
- Server variables[$_SERVER]
Important Resources
- PHP Developer
- PHP Projects With Source Code
- PHP Developer Salary
- Features of PHP
- PHP Frameworks
- Top PHP IDE
- Difference Between PHP 5 and 7
PHP MCQs
Pretext Hypertext Processor
Hypertext preprocessor
Preprocessor Home page
None
Server-side scripting
Client-side scripting
User-side scripting
None
$sub = $sub - 1
$sub = $sub - $sub
$sub = $sub - $sub - 1
$sub = $sub
echo
Both have the same speed
None
No numbers
Letters
Underscore
All of the above
True
False
Depends on variable
None
Objects
void
Null
Resources
False
True
Depends on the condition
None
False
True
Depends on the condition
None
fopen[]
fclosed[]
gettype[]
print_r[]
Removes uppercase alphabet
Removes whitespaces
Removes lowercase alphabet
Removes underscore
template
reference
instances
class
Key function
Automatic function
Find function
Magic function
this
public
private
protected
PHP 6
PHP 4
PHP 5
PHP 5.3
get_argv[]
func_get_argv[]
get_argc[]
func_get_args[]
file[]
glob[]
get_file[]
fold[]
gzcompress[]
compress[]
zip[]
zip_compress[]
dsort[]
asort[]
rsort[]
sort[]
object::methodName[];
object -> methodName[];
$object::methodName[];
$object->methodName[];
Final
Protected
Static
Abstract
function_construct[]
classname[]
function__construct[]
_construct[]
Method adding
Method chaining
Method including
Typecasting
Near-fatal error
Compile-time error
Fatal compile-time error
Fatal run-time error
new exception[]
throws new expection[]
throw new expection[]
New throws exception[]
md5[]
uniqueid[]
id[]
mdid[]
into_array[]
inend_array[]
array_unshift[]
array_push[]
dsort[]
natcasesort[]
naturalsort[]
casesort[]
public
static
friendly
final
Only 2
Only 2 and 3
Only 3 and 4
Only 1 and 4
__call
__invoke
__unset
__wakeup
Source PHP library
Source PHP list
Standard PHP library
Standard PHP list
Portable Operating system interface for Linux
Portable Operating system interface for Unix
Portative Operating system interface for Linux
Portative Operating system interface for Unix
uppercase[]
str_uppercase[]
strtoupper[]
struppercase[]