PHP Yahoo currency API function

Thanks to this post I found a really good function to use the Yahoo currency API to convert currencies really simple.

/**
* Converts currencies with Yahoo currency API
*
* @param string $currency_from the currency you want to convert
* @param string $currency_to the currency you want to convert to
* @param float $currency_input the value you want to convert
*/
function currencyConverter( $currency_from, $currency_to, $currency_input ) {

	// Yahoo currency api url
	$yql_base_url = "http://query.yahooapis.com/v1/public/yql";

	// Query
	$yql_query = 'select * from yahoo.finance.xchange where pair in ("' . $currency_from . $currency_to . '")';

	// Query url
	$yql_query_url = $yql_base_url . "?q=" . urlencode( $yql_query);
	$yql_query_url .= "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";

	// cURL init
	$yql_session = curl_init( $yql_query_url );

	// Set cURL options
	curl_setopt( $yql_session, CURLOPT_RETURNTRANSFER, true );

	// Perform cURL session
	$yqlexec = curl_exec( $yql_session );

	// Json decode results
	$yql_json = json_decode( $yqlexec, true );

	// Get result
	$currency_output = (float) $currency_input * $yql_json['query']['results']['rate']['Rate'];

	// Return result
	return $currency_output;

}

$currency_input = 10;
$currency_from = "USD";
$currency_to = "EUR";
$currency = currencyConverter( $currency_from,$currency_to,$currency_input );

echo $currency_input.' '.$currency_from.' = '.$currency.' '.$currency_to;