Example #1
0
        $type = '<i class="fa fa-pencil"></i>';
    } elseif ($cfs->get('icon', $id)["Photo"] == 'Photo') {
        $type = '<i class="fa fa-picture-o"></i>';
    }
    echo '<div class="Icon">' . $type . '</div>';
    ?>
                    </a>
                </div>
            <?php 
}
wp_reset_query();
?>
        </div>
        <div class="pagination">
            <?php 
nums('post', 5);
?>
        </div>
    </div>
    <div class="content_right">
        <?php 
get_sidebar();
?>
    </div>
</div>
<div class="ask">
    <div class="cont">
        <div class="ask_title">Ask Moustafa</div>
        <div class="ask_content">
            <p>Have a question you’d love to ask me about passion, purpose, motivation, work or life in general?</p>
            <p>Send it over and I’ll answer the best in a future blog post…</p>
Example #2
0
    }
}
$printer = printer();
$printer->send("Hello World");
function nums()
{
    for ($i = 0; $i < 5; ++$i) {
        //get a value from the caller
        $cmd = (yield $i);
        if ($cmd == 'stop') {
            return;
        }
        //exit the function
    }
}
$gen = nums();
foreach ($gen as $v) {
    if ($v == 3) {
        //we are satisfied
        $gen->send('stop');
    }
    echo "{$v}\n";
}
/* 
 * 下面每一行是用分号分割的字段组合,第一个字段将被用作键名。
 */
$input = <<<'EOF'
1;PHP;Likes dollar signs
2;Python;Likes whitespace
3;Ruby;Likes blocks
EOF;
Example #3
0
<?php

//генератор из php5.5
function nums()
{
    echo "START <br>";
    for ($i = 0; $i < 5; ++$i) {
        (yield $i);
        //выкидывает значение в форич и возвращается за остальным кодом
        echo "VALUE: {$i}<br>";
    }
    echo "FINISH <br>";
}
foreach (nums() as $v) {
    //echo "VALUE: $v <br>";
}
/*********/
//возвращение значений
function gen()
{
    (yield 'a');
    (yield 'b');
    (yield 'name' => 'John');
    (yield 'd');
    //yield 10 => 'Hello';
    (yield 'e');
}
foreach (gen() as $k => $v) {
    echo "{$k} : {$v}<br>";
}
/*********/
Example #4
0
<?php

function nums()
{
    for ($i = 0; $i < 3; $i++) {
        (yield $i);
    }
}
foreach (nums() as $num) {
    var_dump($num);
}