Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Created November 9, 2011 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whyisjake/1350602 to your computer and use it in GitHub Desktop.
Save whyisjake/1350602 to your computer and use it in GitHub Desktop.
foreach in a foreach
<?php
$json = file_get_contents('http://makeprojects.com/api/0.1/guide/1019');
$json_output = json_decode($json);
//print_r(json_decode($json));
$steps = $json_output->guide->steps;
foreach ($steps as $step) {
//echo '<li>';
//echo $step->title;
//var_dump($step);
//echo '</li>';
}
$json = file_get_contents('http://makeprojects.com/api/0.1/guide/1019');
$json_output = json_decode($json);
$steps = $json_output->guide->steps;
foreach ($steps as $step) {
//var_dump($step);
echo '<div>';
echo $step->title;
$images = $steps->images;
foreach ($images as $image) {
var_dump($image);
echo $image->lines->text;
}
echo '</div>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment