Skip to content

Instantly share code, notes, and snippets.

@gemblue gemblue/basic.php
Last active Sep 11, 2016

What would you like to do?
PHP Generator Function
// Get number
function get_one_two_three() {
for ($i = 1; $i <= 3; $i++) {
yield $i;
$result = get_one_two_three();
foreach ($result as $value) {
echo "$value\n";
// Helper
function convert($size)
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
echo 'Memory terpakai : ' . convert(memory_get_usage(true));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.