Try to answer these 1000+ PHP MCQs and check your understanding of the PHP subject. Scroll down and let's begin!
A. false
B. " "
C. true
D. an error
A. Traits are class interfaces.
B. Traits are all of these things.
C. Traits allow code reuse without direct inheritance.
D. Traits allow multiple inheritance for classes.
A. backtrace_print
B. print_backtrace
C. backtrace
D. debug_backtrace_print
E. debug_print_backtrace
A. literally except for variables which are expanded
B. literally
C. escape sequences are interpreted
D. None of these
A. Only use the closing tag when short tags are enabled.
B. End all PHP files with '?>'.
C. Omit the closing tag when the file contains only PHP code.
D. There is no recommendation.
A. FALSE FALSE FALSE
B. TRUE FALSE FALSE
C. TRUE TRUE TRUE
D. fatal error when using isset on an array
E. TRUE FALSE TRUE
A. fopen("myFile", "wa")
B. fopen("myFile", "a")
C. fopen("myFile", "r+")
D. fopen("myFile", "w")
A. strtoupper()
B. ucfirst()
C. caps()
D. ucwords()
A. $greet $World;
B. PHP does not support this syntax.
C. $greet('World');
A. "new_value"
B. "old_value"
C. Fatal error, as the variable used in foreach is read-only
A. $class::function()
B. class->function()
C. class.function()
D. $class->function()
E. class::function
A. headers_sent()
B. sent()
C. http_response_code()
D. header()
A. single quoted strings cannot contain line breaks
B. variables names will not be expanded in double quotes
C. variable names will be expanded in double quotes
D. double quoted strings cannot contain line breaks
A. implode(' ',array($s1,$s2))
B. "{$s1} {$s2}"
C. $s1.$s2
D. $s1 + $s2
A. expression.
B. variable.
C. property.
D. argument.
A. $fast, $warp
B. $fast, $superSpeed, $ultraSonic
C. $fast
D. $superSpeed, $ultraSonic
E. $fast, $superSpeed, $ultraSonic, $warp
A. All of these
B. dollar sign($)
C. percent(%)
D. underscore(_)
A. Five
B. One
C. Two
D. More than two
E. None
A. $aVaR
B. ${“MyVar”}
C. $10_var
D. $_10
A. 2I
B. 67
C. P
D. &
A. PHP statement.
B. All of these
C. PHP array.
D. PHP function.
A. 2
B. 4
C. 3
D. 5
E. 1
A. Key
B. Textual
C. Associative
D. All of these
A. bool(false)
B. int(5)
C. bool(true)
D. string(1) "5"
A. $arr = implode('-', $str); $arr = implode('.', $arr[0]);
B. You can't
C. $arr = explode('-', $str); $arr = explode('.', $arr[0]);
D. $arr = str_replace('-', '', $str);
A. mt_random()
B. unpack()
C. php_create_user()
D. uniqid()
A. It is a library that gives the PHP the capability to access and create virtual domains. - (Generated Domain)
B. It is a library that gives the PHP the capability to create and manipulate image files. - (Gif Draw)
C. it's add a dozen of special new $_GLOBAL variables that gives principally informations on the user (localization, common social media cookies, etc...) - (Global iDentification)
A. fastest faster
B. fastest fastest
C. faster faster
D. faster fastest
A. method
B. protected
C. function
D. public
A. session_pw
B. session_destroy
C. session_decode
D. session_id
A. Function
B. Element
C. Parameters
D. String
A. E_ERROR
B. E_WARNING
C. ERROR
D. E_NOTICE
A. isset()
B. array_key_exists()
C. element()
D. for_each()
A. mysql_real_escape_string()
B. mysql_escape()
C. escape_mysql_string()
D. None of the above
E. mysqlescapethisstring()
A. awalk()
B. asort()
C. sort()
D. array_alpha()
A. $var = (bool)$var;
B. $var = ($var == $var);
C. Both are valid statements.
D. It's not possible to typecast variables like this.
A. ftp_chmod()
B. ftp_login()
C. ftp_connect()
D. ftp_chdir()
E. ftp_mkdir()
A. Array
B. 0
C. 2
D. 3
A. queries available in PHP.
B. database extensions available in PHP.
C. form extensions available in PHP
D. All of these
A. printf("Hello %s", $name);
B. print("Hello %s", $name);
C. echo("Hello %s", $name);
D. output("Hello %s", $name);
A. lib
B. blob
C. bin
D. blurb
A. str_to_time()
B. strtodate()
C. strtotime()
D. stroftime()
A. True
B. False
A. My name is OConnor.
B. My name is O'Connor.
C. None of these
D. My name is O\'Connor.
A. remove
B. clearfile
C. delete
D. unlink
A. remove_html_php()
B. tag_remove()
C. remove_tags()
D. strip_tags()
A. aa
B. PHP Parse error
C. truea
D. a
A. integer
B. double
C. strings
D. float
A. syntax error
B. falsefalse
C. true
D. false
E. None of the these
A. Function
B. Class
C. Exception
D. Conditional