What is the best practice for passing values in a URL query string in PHP?

When passing values in a URL query string in PHP, it is important to properly encode the values to ensure they are passed correctly and securely. The recommended practice is to use the `urlencode()` function to encode the values before appending them to the URL. This helps prevent issues with special characters and ensures the values are passed as intended.

// Example of passing values in a URL query string in PHP
$value1 = 'Hello World';
$value2 = '12345';

$url = 'example.com/?param1=' . urlencode($value1) . '&param2=' . urlencode($value2);

echo $url;