Welcome to Interviewbit, help us create the best experience for you!

Currently, You are a:

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your career...

Current Company *
Enter company name
Experience *

You're all set!

Begin your success journey!

Sign Up using
Full name *
Email *
Password *

By creating an account, I acknowledge that I have read and agree to InterviewBit’s Terms and Privacy Policy .

Welcome back!

Log In using
Email *
Password *

PHP MCQ With Answers

Begin your success journey!

Sign Up using
Full name *
Email *
Password *

By creating an account, I acknowledge that I have read and agree to InterviewBit’s Terms and Privacy Policy .

Welcome back!

Log In using
Email *
Password *

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)

PHP MCQs

1. 

Full form of PHP is?

2. 

Choose the default file extension of PHP among the following.

3. 

What type of language is PHP?

4. 

Choose the correct syntax of PHP.

5. 

Choose the equivalent of the statement : $sub -= $sub.

6. 

Total ways in which user a print output in PHP is -

7. 

Among echo and print, which is faster?

8. 

In PHP, variable names must start with which of the following.

9. 

Is PHP variable case sensitive?

10. 

Total variable scope in PHP is?

11. 

Choose the incorrect data type among the following.

12. 

Total looping techniques supported by PHP are?

13. 

Choose whether true or false: the do-while loop is an exit control loop.

14. 

Choose whether true or false: while loop is an exit control loop.

15. 

Identify the function among the following, which is not built-in.

16. 

Functions in PHP should start with which of the following keyword?

17. 

Total types of the array in PHP is?

18. 

Index of an array by default starts with which of the following in PHP?

19. 

trim() in PHP is used for?

20. 

Another term used for Objects is?

21. 

Using which keyword is the object created?

22. 

Another name of the constructor is?

23. 

Among the following options, choose the term which is used to refer to methods within the class itself.

24. 

In which version of PHP was Type Hinting introduced?

25. 

Among the following functions, choose the one which accepts any number of parameters.

26. 

Which of the following is used to find files?

27. 

Identify the function which is used to compress a string.

28. 

Which of the following function is used to sort array in descending order?

29. 

Choose the correct way to invoke a method among the following.

30. 

Choose the option which prevents a method from being overridden by a subclass?

31. 

In PHP, how are constructors recognized?

32. 

Identify the feature, which allows calling one or more methods or functions in single instruction?

33. 

Total error levels available in PHP are?

34. 

Error level E_ERROR denotes?

35. 

Identify the options among the following which invokes the exception class.

36. 

Identify the options among the following which generates unique ids

37. 

Find the output of the code below:

<?PHP
 ECHO CHR(52);
?>
38. 

Find the output of the code below:

<?PHP
 ECHO ORD(“HI”);
?>
39. 

Identify the function which adds a value at the end of an array?

40. 

Find the output of the code below:

<?PHP
$arr = ARRAY(12,5,2);
 ECHO (ARRAY_PRODUCT($A));
?>
41. 

Which of the following function is used to sort arrays in the natural order?

42. 

Identify the property scope not supported by PHP.

43. 

From which of the following class does the child class inherits?

  1. Child class
  2. Super class
  3. Base class
  4. Parent class
44. 

To implement overloading, which of the following magic method used?

45. 

Full form of SPL is?

46. 

Total types of filtering present in PHP?

47. 

Identify the regular expression which matches any expression string having zero or one P?

48. 

Full form of POSIX is?

49. 

Identify the function which converts a string to uppercase.

50. 

The function FILESIZE() returns the size of the file in?

Get Placed at Top Product Companies with Scaler Know More 
Get Placed at Top Product Companies with Scaler
Sat transparent 640a34d454880bf68e3bfdf33f2389f2214043f59ad18b4c7f7b114e834fb257.svg

Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Personalised feedback report with solutions
Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Real life Interview Questions
Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Identify exact topics to improve

Your feedback is important to help us improve.
Free Mock Assessment
Help us know you better for the best experience
Current Employer *
Enter company name
College you graduated from *
Enter university name
Phone Number *
OTP will be sent to this number for verification
+91
+1
+247
+376
+971
+93
+1
+1
+355
+374
+244
+54
+1
+43
+61
+297
+358
+994
+387
+1
+880
+32
+226
+359
+973
+257
+229
+590
+1
+673
+591
+599
+55
+1
+975
+267
+375
+501
+1
+61
+243
+236
+242
+41
+225
+682
+56
+237
+86
+57
+506
+53
+238
+599
+61
+357
+420
+49
+253
+45
+1
+1
+213
+593
+372
+20
+212
+291
+34
+251
+358
+679
+500
+691
+298
+33
+241
+44
+1
+995
+594
+44
+233
+350
+299
+220
+224
+590
+240
+30
+502
+1
+245
+592
+852
+504
+385
+509
+36
+62
+353
+972
+44
+91
+246
+964
+98
+354
+39
+44
+1
+962
+81
+254
+996
+855
+686
+269
+1
+850
+82
+965
+1
+7
+856
+961
+1
+423
+94
+231
+266
+370
+352
+371
+218
+212
+377
+373
+382
+590
+261
+692
+389
+223
+95
+976
+853
+1
+596
+222
+1
+356
+230
+960
+265
+52
+60
+258
+264
+687
+227
+672
+234
+505
+31
+47
+977
+674
+683
+64
+968
+507
+51
+689
+675
+63
+92
+48
+508
+1
+970
+351
+680
+595
+974
+262
+40
+381
+7
+250
+966
+677
+248
+249
+46
+65
+290
+386
+47
+421
+232
+378
+221
+252
+597
+211
+239
+503
+1
+963
+268
+290
+1
+235
+228
+66
+992
+690
+670
+993
+216
+676
+90
+1
+688
+886
+255
+380
+256
+598
+998
+39
+1
+58
+1
+1
+84
+678
+681
+685
+383
+967
+262
+27
+260
+263
+979
Change Number
Edit
Resend OTP
By Continuing I agree to be contacted by Scaler in the future.