Thor
Honorary Master
- Joined
- Jun 5, 2014
- Messages
- 44,236
[)roi(];18131541 said:No worries; simple conversion of _kabal_'s approach to use of higher order functions.
This:
PHP:
function convert($v)
{
return [strtotime($v->dateTime), $v->value];
}
and this:
PHP:
json_encode(array_map('convert', $json->priceTimeSeries[0]->price))
was an eye opener.
I came close I did it like this:
PHP:
$currency_history = $json->priceTimeSeries[0]->price))
I was close, but yet so far.
Thanks again this helps a lot!!!
Now the storing.
Tired me wants to just save $url and then run the loop on the stored $url
PHP:
$statement = $db->prepare("INSERT INTO `currency` (`url_contents`) VALUES (:url_contents)");
$statement->execute(array(':url_contents' => file_get_contents($url)));
Young and exciting me wants to learn joins in order to store array_map to the DB
Last edited:
