COUNTABLE(3) 1 COUNTABLE(3)The Countable interfaceINTRODUCTION
Classes implementing Countable can be used with the count(3) function.
INTERFACE SYNOPSIS
Countable
Countable
Methods
o abstractpublic int Countable::count (void )
PHP Documentation Group COUNTABLE(3)
Check Out this Related Man Page
ITERATOR(3) 1 ITERATOR(3)The Iterator interfaceINTRODUCTION
Interface for external iterators or objects that can be iterated themselves internally.
INTERFACE SYNOPSIS
Iterator
Iteratorextends
Traversable
Methods
o abstractpublic mixed Iterator::current (void )
o abstractpublic scalar Iterator::key (void )
o abstractpublic void Iterator::next (void )
o abstractpublic void Iterator::rewind (void )
o abstractpublic boolean Iterator::valid (void )
PREDEFINED ITERATORS
PHP already provides a number of iterators for many day to day tasks. See SPL iterators for a list.
EXAMPLES
Example #1
Basic usage
This example demonstrates in which order methods are called when using foreach with an iterator.
<?php
class myIterator implements Iterator {
private $position = 0;
private $array = array(
"firstelement",
"secondelement",
"lastelement",
);
public function __construct() {
$this->position = 0;
}
function rewind() {
var_dump(__METHOD__);
$this->position = 0;
}
function current() {
var_dump(__METHOD__);
return $this->array[$this->position];
}
function key() {
var_dump(__METHOD__);
return $this->position;
}
function next() {
var_dump(__METHOD__);
++$this->position;
}
function valid() {
var_dump(__METHOD__);
return isset($this->array[$this->position]);
}
}
$it = new myIterator;
foreach($it as $key => $value) {
var_dump($key, $value);
echo "
";
}
?>
The above example will output something similar to:
string(18) "myIterator::rewind"
string(17) "myIterator::valid"
string(19) "myIterator::current"
string(15) "myIterator::key"
int(0)string(12) "firstelement"
string(16) "myIterator::next"
string(17) "myIterator::valid"
string(19) "myIterator::current"
string(15) "myIterator::key"
int(1)string(13) "secondelement"
string(16) "myIterator::next"
string(17) "myIterator::valid"
string(19) "myIterator::current"
string(15) "myIterator::key"
int(2)string(11) "lastelement"
string(16) "myIterator::next"
string(17) "myIterator::valid"
PHP Documentation Group ITERATOR(3)
I am trying to analyze the performance of an AIX system. I think I may have a disk I/O issue, but I am asking for help to validate or invalidate this assumption. I ran the commands below during a period of peak load.
Please help me to find any performance bottlenecks. Thanks in advance for your... (15 Replies)
does anyone know how to write a script that will change file permissions. because the Admin blocked me from altering any of my files im only allowed to read and i heard a script like this can bypass it but i dont know how to write it.
Display current users. Display user Ids only.
Display... (10 Replies)
folks,
I have a security related question, to all you. Please share your comments with me.
I have a situation where i was asked to automate the password in my application, which expires every 6 months. In this case i need to generate a random password and set the password on some... (2 Replies)
I am just curious about your opinion on something which I am against.
I work at the client location. Our office is very small (4 employees + 1 teamlead where 1 employee per 12hrs shifts) and we are responsible to process the reception of external files into the client's database via some tools.... (3 Replies)
Hello,
I am pretty new to shell scripts and I recently wrote one that seems to do what it should but I am exploring the possibility of improving its performance and would appreciate some help. Here is what it does - Its meant to monitor a bunch of systems (reads in IPs one at a time from a flat... (9 Replies)
I want to send an email, however I like to subject line of the email to be different, depending on the content or body of the email, is this possible.
Ok - lets say the body of the email will always have the word job name, and depending on the 4,5 and 6 position of the job name, in this case... (1 Reply)
I have gotten myself totally lost trying to sort this out and just need some help please..
I will have a multiple directories using the following naming convention with an undetermined number of files in each directory.
9780743582094_05of5_Accountable.wav
I need to batch rename all files... (5 Replies)
Hi,
I want to mirror root hard disk in SUSE LINUX 10.1.
I have two 80G hard disks, I searched in google but I did not find any good link to describe this.
Please see below info..
Server1:~ # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 16G... (10 Replies)
(1) Hi, Am working on FreeBSD 7.4/i386 and installed Opera 11.01 through ports collection manually... But when I run first time am getting "opera: cannot connect X server. Error: Unknown error: 0" What is this error all about???? Please help me to sort out this issue!!!
(2) Hi, currently am... (12 Replies)
Never expired for root password
Guy's
I want to change the setting to keep the root password to be nerved expired!
Please advice with the sitting! (9 Replies)
Virtual Machine running on VMWare workstation 9.2
os : RHEL 5.8
RAM : 2.5GB
Swap : 2.6gb
CPU : 1 virtual CPU
Surprizingly I couldn't find much from googling on What exactly does Kernel parameters do ?
I was under the impression that kernel parameters just set the limits/maximum for a... (2 Replies)
In the following command:
find / -ctime +3 -exec rm -R {}\;
how is the recursion list built for the actual rm ?
F'rinstance; I had a case where a user typed this as root using '/' instead of '.' so everything in the root level was going to be traversed. They hit <ctrl>C before too much was... (5 Replies)
What Online Social Networks Do You Use Regularly?
I use Facebook and LinkedIn nearly everyday....
You?
If your online social network is not listed, please do a "write in" vote..
Thanks! (39 Replies)
Why Do We Need Root on the HMC?
In this article in IBMSystems Magazine Rob McNelly asked the question
Why Don't We Have Root on the HMC?
and he goes on to justify why we indeed shouldn't have root - kinda. I think his arguments are not as valid as he perhaps thinks they are and what's more... (11 Replies)
Interesting to read about the origin of the MalWareBytes company.
Link from BBC Business news:
'I kept my multimillion dollar business secret' - BBC News (3 Replies)