Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

PHP Interview Questions with 100% CorrecT Answers

Rating
-
Sold
-
Pages
16
Grade
A+
Uploaded on
22-02-2025
Written in
2024/2025

PHP Interview Questions with 100% CorrecT Answers

Institution
PHP
Course
PHP

Content preview

PHP Interview Questions with 100%
CorrecT Answers

PHP does a good job of automatically converting types from one to another when
necessary.


PHP variables are Perl-like.



What are the different types of PHP variables? - ANSWER PHP has a total of eight
data types which we use to construct our variables −


Integers − are whole numbers, without a decimal point, like 4195.


Doubles − are floating-point numbers, like 3.14159 or 49.1.


Booleans − have only two possible values either true or false.


NULL − is a special type that only has one value: NULL.


Strings − are sequences of characters, like 'PHP supports string operations.'


Arrays − are named and indexed collections of other values.

,Objects − are instances of programmer-defined classes, which can package up both
other kinds of values and functions that are specific to the class.



Resources − are special variables that hold references to resources external to PHP
(such as database connections).



What are rules for naming a PHP variable? - ANSWER Rules for naming a variable
are following −


Variable names must begin with a letter or underscore character.



A variable name can consist of numbers, letters, underscores but you cannot
use characters like + , - , % , ( , ) . & , etc



What are the rules for determine the "truth" of any value not already of the Boolean
type? - ANSWER Here are the rules for determine the "truth" of any value not already
of the Boolean type −


If the value is a number, it is false if exactly equal to zero and true otherwise.



If the value is a string, it is false if the string is empty (has zero characters) or is the
string "0", and is true otherwise.


Values of type NULL are always false.



If the value is an array, it is false if it contains no other values, and it is true
otherwise. For an object, containing a value means having a member variable that
has been assigned a value.

, Valid resources are true (although some functions that return resources when they
are successful will return FALSE when unsuccessful).


Don't use double as Booleans.


What is NULL? - ANSWER NULL is a special type that only has one value: NULL.


The special constant NULL is capitalized by convention, but actually it is case insensitive


A variable that has been assigned NULL has the following properties:


It evaluates to FALSE in a Boolean context.


It returns FALSE when tested with IsSet() function.



How will you define a constant in PHP? - ANSWER To define a constant you have to
use define() function and to retrieve the value of a constant, you have to simply
specifying its name. Unlike with variables, you do not need to have a constant with a
$.



What is the purpose of constant() function? - ANSWER this function will return the
value of the constant. This is useful when you want to retrieve value of a constant, but
you do not know its name


Only scalar data (boolean, integer, float and string) can be contained in constants.



What are the differences between PHP constants and variables? - ANSWER There is no
need to write a dollar sign ($) before a constant, where as in Variable one has to write a
dollar sign.

Written for

Institution
PHP
Course
PHP

Document information

Uploaded on
February 22, 2025
Number of pages
16
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$13.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Thumbnail
Package deal
PHP EXAMS BUNDLE OF QUESTIONS AND ANSWERS
-
7 2025
$ 93.93 More info

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
KenAli West Virginia University
View profile
Follow You need to be logged in order to follow users or courses
Sold
91
Member since
1 year
Number of followers
5
Documents
17546
Last sold
1 week ago

2.6

17 reviews

5
2
4
4
3
4
2
0
1
7

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions