Skip to content

Instantly share code, notes, and snippets.

@ethaizone
Created September 25, 2016 13:42
Show Gist options
  • Save ethaizone/401dee3d21e356d0ab3305cb88cb4096 to your computer and use it in GitHub Desktop.
Save ethaizone/401dee3d21e356d0ab3305cb88cb4096 to your computer and use it in GitHub Desktop.
How-to make you don't forget to comment your code.
// create array for hold all dogs data
// just loop by get data from getNames()
// getNames() is generator so it's simple loop
// and we just need 5 dogs only
// each dog will name as value
// echo all dogs as json
// create array for hold all dogs data
$dogs = [];
// just loop by get data from getNames()
// getNames() is generator so it's simple loop
// and we just need 5 dogs only
foreach(getNames(5) as $name) {
// each dog will name as value
$dogs[] = $name;
}
// echo all dogs as json
echo json_encode($dogs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment