I have an array $s which stores incoming data from a JSON feed. The format of the array is like this:
$s = array("tweets"=>1, "likes"=>4, "plusones"=>7);
How would I loop through the array: $s, and pick the values of the keys so that I can then assign to the variables $tweets, $likes and $plusones.
This was what I did but I'm not able to extract the values and store them in the variables I've set to nil
foreach($social_shares as $social_share=>$include){
echo $social_share . ": " . $include . "<br>";
$tweets = nil;
$likes = nil;
$plusones = nil;
$sql4 = mysql_query("INSERT INTO social_shares(article_id, tweets, likes, plusones ) VALUES ($s -> article_id ,'$tweets', '$likes', '$plusones')");
}