示例#1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $fraggles = (include __DIR__ . '/../../../examples/fraggles.php');
     $arrayIterator = new \ArrayIterator($fraggles);
     // Print the array
     $output->writeln("The array in natural order");
     foreach ($arrayIterator as $thisFraggle) {
         $output->writeln("  " . $thisFraggle);
     }
     // print the array sorted
     $output->writeln("The array in alphabetical order");
     $arrayIterator->asort();
     foreach ($arrayIterator as $thisFraggle) {
         $output->writeln("  " . $thisFraggle);
     }
     // print the array sorted
     $output->writeln("Emprorer First order");
     $arrayIterator->uasort([$this, 'emperorFirst']);
     foreach ($arrayIterator as $thisFraggle) {
         $output->writeln("  " . $thisFraggle);
     }
     $output->writeln("Done");
     return;
 }
示例#2
0
 public function asort()
 {
     parent::asort();
     $this->refreshPositions();
 }
示例#3
0
文件: 443.php 项目: badlamer/hhvm
<?php

$a = array(1, 2, 3);
$o = new ArrayIterator($a);
var_dump($o->next());
var_dump($o->rewind());
var_dump($o->seek());
var_dump($o->asort());
var_dump($o->ksort());
var_dump($o->natsort());
var_dump($o->natcasesort());