-
Notifications
You must be signed in to change notification settings - Fork 10
Looper
Devin Smith edited this page Feb 3, 2016
·
10 revisions
Looper provides an interface similar to Iterator with some Resource specific features.
Looper allows the use of $object->each()
, foreach ($object)
, or while($object->valid()
interchangeably.
foreach ($loop as $item) {
//item
}
or
$loop->each(function() {
// $this
});
or
while ($loop->valid()) {
// $loop->current()
$loop->next();
}
$loop = new \Tipsy\Looper([ (object)['a' => 1], (object)['a' => 2], (object)['a' => 3] ]); $val = 0; $loop->each(function() use (&$val) { $val += $this->a; }); echo $val; // outputs 6
- Home
- Getting Started
- Server Config
- Installation
- Installing Composer
- App
- Route Shorthand
- Config
- Routes
- Methods
- Controller Types
- Params & Regex
- Aliases
- Dependency Injection
- Advanced Routing
- Services
- User Defined Services
- Built in Services
- Middleware
- Views
- Templates
- Scope
- Resource
- Factory
- Looper
- Examples
- Plugins
- About