How can the order of execution of echo statements and print_r() affect the output sequence in PHP scripts involving CURL requests?

The order of execution of echo statements and print_r() can affect the output sequence in PHP scripts involving CURL requests because print_r() prints the information about a variable in a human-readable format, while echo simply outputs data. If print_r() is called after echo statements, it may disrupt the expected output sequence. To solve this issue, ensure that print_r() is called before any echo statements to maintain the proper sequence of output.

<?php
// Initialize CURL session
$ch = curl_init();

// Set CURL options
curl_setopt($ch, CURLOPT_URL, 'https://api.example.com/data');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute CURL request
$response = curl_exec($ch);

// Close CURL session
curl_close($ch);

// Print the CURL response using print_r()
print_r($response);

// Echo additional information
echo 'Additional information here';
?>