0
0
PHPprogramming~20 mins

PHP Installation and Setup - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PHP Installation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
Output of PHP Version Check
What is the output of this PHP code snippet when run on a properly installed PHP 8.1 environment?
PHP
<?php
 echo PHP_VERSION;
?>
Aphp_version
BPHP_VERSION
C8.1.x (where x is the patch version)
DSyntaxError
Attempts:
2 left
💡 Hint
PHP_VERSION is a predefined constant that holds the current PHP version as a string.
Predict Output
intermediate
1:30remaining
Result of phpinfo() Function
What does the phpinfo() function output when called in a PHP script?
PHP
<?php
 phpinfo();
?>
AA detailed HTML page showing PHP configuration and environment
BA plain text list of PHP functions
CAn error message about undefined function
DNothing, it returns an empty string
Attempts:
2 left
💡 Hint
phpinfo() outputs configuration info about PHP in HTML format.
Predict Output
advanced
1:30remaining
Behavior of PHP Script Without Closing Tag
What happens if a PHP script file ends without the closing ?> tag?
PHP
<?php
 echo 'Hello, world!';
AThe script runs normally and outputs 'Hello, world!'
BSyntax error due to missing closing tag
CThe script outputs 'Hello, world!?>'
DThe script outputs nothing
Attempts:
2 left
💡 Hint
PHP closing tag is optional at the end of a file.
Predict Output
advanced
1:30remaining
Output of PHP Script with Short Open Tag Disabled
Given the following PHP code and assuming short_open_tag is disabled in php.ini, what will be the output?
PHP
<?php
 echo 'Test';
?>
ASyntax error due to short open tag
BThe literal string '<? echo 'Test'; ?>' is output
CNo output at all
DThe string 'Test' is output
Attempts:
2 left
💡 Hint
Short open tags
🧠 Conceptual
expert
2:00remaining
Understanding PHP Configuration File Location
Where does PHP look for its main configuration file (php.ini) by default when installed on a Linux system?
A/usr/local/lib/php.ini
B/var/www/html/php.ini
C/etc/php.ini
D/etc/php/8.1/cli/php.ini
Attempts:
2 left
💡 Hint
PHP version and SAPI (like CLI or Apache) affect the php.ini location.