PHP QUESTIONS AND CORRECT
ANSWERS
WhatA2doesA2phpA2standA2for?A2-A2Ans--
PHPA2standsA2forA2PHP:A2HypertextA2Preprocessor
isA2PHPA2serverA2sideA2orA2clientA2sideA2scriptingA2language?A2-A2Ans--serverA2side
howA2areA2phpA2filesA2returnedA2toA2theA2browser?A2-A2Ans--
PHPA2filesA2areA2returnedA2toA2theA2browserA2asA2plainA2HTML
howA2isA2aA2phpA2startedA2andA2ended?A2-A2Ans--
AA2PHPA2scriptingA2blockA2alwaysA2startsA2withA2<?phpA2andA2endsA2withA2?>
whereA2canA2aA2phpA2scriptA2beA2placedA2inA2theA2document?A2-A2Ans--anywhere
howA2mustA2eachA2phpA2codeA2lineA2end?A2-A2Ans--withA2aA2semiA2colon
whatA2isA2theA2purposeA2ofA2theA2semiA2colon?A2-A2Ans--
itA2isA2aA2separatorA2andA2usedA2toA2distinguishA2oneA2setA2ofA2instructionsA2fromA2another
whatA2areA2twoA2basicA2statementsA2toA2outputA2textA2withA2PHP?A2-A2Ans--
echoA2andA2print
whatA2happensA2ifA2theA2phpA2fileA2hasA2anA2htmlA2extensionA2insteadA2ofA2PHP?A2-
A2Ans--theA2phpA2codeA2willA2notA2beA2executed
howA2isA2aA2singleA2lineA2commentA2madeA2inA2php?A2-A2Ans--WithA2//
howA2isA2aA2commentA2blockA2made?A2-A2Ans--/*A2*/
WhatA2areA2variablesA2usedA2for?A2-A2Ans--
VariablesA2areA2usedA2forA2storingA2values,A2suchA2asA2numbers,A2stringsA2orA2functionA2r
esults,A2soA2thatA2theyA2canA2beA2usedA2manyA2timesA2inA2aA2script.
whatA2doA2allA2variablesA2startA2with?A2-A2Ans--
AllA2variablesA2inA2PHPA2startA2withA2aA2$A2signA2symbol.
TheA2correctA2wayA2ofA2settingA2aA2variableA2inA2PHP:A2-A2Ans--$var_nameA2=A2value;
isA2PHPA2stronglyA2orA2looselyA2typed?A2-A2Ans--loosely
, inA2phpA2doesA2aA2variableA2needA2toA2beA2declaredA2(created)A2beforeA2beingA2set?A2-
A2Ans--
no,A2phpA2automaticallyA2createsA2theA2variableA2andA2setsA2itA2toA2theA2correctA2type.
WhatA2isA2meantA2byA2theA2termA2stronglyA2typed?A2-A2Ans--
variablesA2haveA2toA2beA2definedA2beforeA2theyA2canA2beA2used
inA2phpA2howA2mustA2aA2variableA2nameA2start?A2-A2Ans--
AA2variableA2nameA2mustA2startA2withA2aA2letterA2orA2anA2underscoreA2_
WhatA2kindsA2ofA2charactersA2canA2aA2variableA2nameA2contain?A2-A2Ans--
AA2variableA2nameA2canA2onlyA2containA2alpha-
numericA2charactersA2andA2underscoresA2(a-z,A2A-Z,A20-9,A2andA2_A2)
shouldA2aA2variableA2nameA2containA2spaces?A2-A2Ans--no
ifA2aA2variableA2nameA2isA2moreA2thanA2oneA2wordA2howA2shouldA2itA2beA2formatted?A2-
A2Ans--withA2anA2underscoreA2betweenA2wordsA2orA2withA2theA2secondA2wordA2capitalized
WhatA2isA2aA2stringA2variableA2usedA2for?A2-A2Ans--
AA2stringA2variableA2isA2usedA2toA2storeA2andA2manipulateA2aA2pieceA2ofA2text.
WhatA2isA2theA2onlyA2stringA2operatorA2inA2php?A2-A2Ans--
TheA2concatenationA2operatorA2(.)
WhatA2isA2theA2concatenationA2operatorA2usedA2for?A2-A2Ans--
toA2putA2twoA2stringA2valuesA2together.
whatA2areA2operatorsA2usedA2for?A2-A2Ans--
OperatorsA2areA2usedA2toA2operateA2onA2values.
WhatA2kindsA2ofA2differentA2operatorsA2exist?A2-A2Ans--
arithmetic,A2assignment,A2comparison,A2andA2logical
whenA2shouldA2theA2ifA2elseA2statementA2beA2used?A2-A2Ans--
ifA2youA2wantA2toA2executeA2aA2setA2ofA2codeA2whenA2aA2conditionA2isA2trueA2andA2anotherA
2ifA2theA2conditionA2isA2notA2true
whenA2shouldA2theA2elseA2ifA2statementA2beA2used?A2-A2Ans--
isA2usedA2withA2theA2if...elseA2statementA2toA2executeA2aA2setA2ofA2codeA2ifA2oneA2ofA2sever
alA2conditionA2areA2true
ifA2moreA2thanA2oneA2lineA2isA2toA2beA2executedA2asA2aA2resultA2ofA2theA2ifA2elseA2statemen
tA2thenA2theA2linesA2toA2beA2executedA2shouldA2beA2enclosedA2inA2curlyA2bracesA2-
A2Ans--...
ANSWERS
WhatA2doesA2phpA2standA2for?A2-A2Ans--
PHPA2standsA2forA2PHP:A2HypertextA2Preprocessor
isA2PHPA2serverA2sideA2orA2clientA2sideA2scriptingA2language?A2-A2Ans--serverA2side
howA2areA2phpA2filesA2returnedA2toA2theA2browser?A2-A2Ans--
PHPA2filesA2areA2returnedA2toA2theA2browserA2asA2plainA2HTML
howA2isA2aA2phpA2startedA2andA2ended?A2-A2Ans--
AA2PHPA2scriptingA2blockA2alwaysA2startsA2withA2<?phpA2andA2endsA2withA2?>
whereA2canA2aA2phpA2scriptA2beA2placedA2inA2theA2document?A2-A2Ans--anywhere
howA2mustA2eachA2phpA2codeA2lineA2end?A2-A2Ans--withA2aA2semiA2colon
whatA2isA2theA2purposeA2ofA2theA2semiA2colon?A2-A2Ans--
itA2isA2aA2separatorA2andA2usedA2toA2distinguishA2oneA2setA2ofA2instructionsA2fromA2another
whatA2areA2twoA2basicA2statementsA2toA2outputA2textA2withA2PHP?A2-A2Ans--
echoA2andA2print
whatA2happensA2ifA2theA2phpA2fileA2hasA2anA2htmlA2extensionA2insteadA2ofA2PHP?A2-
A2Ans--theA2phpA2codeA2willA2notA2beA2executed
howA2isA2aA2singleA2lineA2commentA2madeA2inA2php?A2-A2Ans--WithA2//
howA2isA2aA2commentA2blockA2made?A2-A2Ans--/*A2*/
WhatA2areA2variablesA2usedA2for?A2-A2Ans--
VariablesA2areA2usedA2forA2storingA2values,A2suchA2asA2numbers,A2stringsA2orA2functionA2r
esults,A2soA2thatA2theyA2canA2beA2usedA2manyA2timesA2inA2aA2script.
whatA2doA2allA2variablesA2startA2with?A2-A2Ans--
AllA2variablesA2inA2PHPA2startA2withA2aA2$A2signA2symbol.
TheA2correctA2wayA2ofA2settingA2aA2variableA2inA2PHP:A2-A2Ans--$var_nameA2=A2value;
isA2PHPA2stronglyA2orA2looselyA2typed?A2-A2Ans--loosely
, inA2phpA2doesA2aA2variableA2needA2toA2beA2declaredA2(created)A2beforeA2beingA2set?A2-
A2Ans--
no,A2phpA2automaticallyA2createsA2theA2variableA2andA2setsA2itA2toA2theA2correctA2type.
WhatA2isA2meantA2byA2theA2termA2stronglyA2typed?A2-A2Ans--
variablesA2haveA2toA2beA2definedA2beforeA2theyA2canA2beA2used
inA2phpA2howA2mustA2aA2variableA2nameA2start?A2-A2Ans--
AA2variableA2nameA2mustA2startA2withA2aA2letterA2orA2anA2underscoreA2_
WhatA2kindsA2ofA2charactersA2canA2aA2variableA2nameA2contain?A2-A2Ans--
AA2variableA2nameA2canA2onlyA2containA2alpha-
numericA2charactersA2andA2underscoresA2(a-z,A2A-Z,A20-9,A2andA2_A2)
shouldA2aA2variableA2nameA2containA2spaces?A2-A2Ans--no
ifA2aA2variableA2nameA2isA2moreA2thanA2oneA2wordA2howA2shouldA2itA2beA2formatted?A2-
A2Ans--withA2anA2underscoreA2betweenA2wordsA2orA2withA2theA2secondA2wordA2capitalized
WhatA2isA2aA2stringA2variableA2usedA2for?A2-A2Ans--
AA2stringA2variableA2isA2usedA2toA2storeA2andA2manipulateA2aA2pieceA2ofA2text.
WhatA2isA2theA2onlyA2stringA2operatorA2inA2php?A2-A2Ans--
TheA2concatenationA2operatorA2(.)
WhatA2isA2theA2concatenationA2operatorA2usedA2for?A2-A2Ans--
toA2putA2twoA2stringA2valuesA2together.
whatA2areA2operatorsA2usedA2for?A2-A2Ans--
OperatorsA2areA2usedA2toA2operateA2onA2values.
WhatA2kindsA2ofA2differentA2operatorsA2exist?A2-A2Ans--
arithmetic,A2assignment,A2comparison,A2andA2logical
whenA2shouldA2theA2ifA2elseA2statementA2beA2used?A2-A2Ans--
ifA2youA2wantA2toA2executeA2aA2setA2ofA2codeA2whenA2aA2conditionA2isA2trueA2andA2anotherA
2ifA2theA2conditionA2isA2notA2true
whenA2shouldA2theA2elseA2ifA2statementA2beA2used?A2-A2Ans--
isA2usedA2withA2theA2if...elseA2statementA2toA2executeA2aA2setA2ofA2codeA2ifA2oneA2ofA2sever
alA2conditionA2areA2true
ifA2moreA2thanA2oneA2lineA2isA2toA2beA2executedA2asA2aA2resultA2ofA2theA2ifA2elseA2statemen
tA2thenA2theA2linesA2toA2beA2executedA2shouldA2beA2enclosedA2inA2curlyA2bracesA2-
A2Ans--...