Created
September 25, 2016 13:42
-
-
Save ethaizone/401dee3d21e356d0ab3305cb88cb4096 to your computer and use it in GitHub Desktop.
How-to make you don't forget to comment your code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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