Arquivos
hhvm/hphp/test/slow/ext_array/key.php
T
Jordan DeLong 9e127b9831 Rewrite TestExtArray in php
Most of this is ported over, except some omissions:
  - array_filter, array_key_exists (suspected we had coverage already;
    one is a bytecode, and one was rewritten in hhas recently)
  - some random cases distinguishing init_null_variant vs. null_variant
2013-06-18 16:23:18 -07:00

23 linhas
419 B
PHP

<?php
$array = array(
"fruit1" => "apple",
"fruit2" => "orange",
"fruit3" => "grape",
"fruit4" => "apple",
"fruit5" => "apple"
);
// this cycle echoes all associative array
// key where value equals "apple"
$output = '';
while (true) {
$fruit_name = current($array);
if ($fruit_name === false) break;
if ($fruit_name === 'apple') {
$output .= key($array);
}
next($array);
}
var_dump($output);