Quiz: Avoiding Traps When Using PHP 8 Extensions

Test your understanding of avoiding traps while using PHP 8 extensions.

1

What would be the output of the following code in PHP 8?

<?php
$url = 'https://unlikelysource.com/';
$ch = curl_init($url);
if (is_resource($ch)) {
    echo "Connection Established\n";
} else {
    throw new Exception('Unable to establish connection');
}
?>
A)

Connection Established

B)

Notice

C)

Warning

D)

Fatal Error: Unable to establish connection

Question 1 of 50 attempted

Get hands-on with 1400+ tech skills courses.