This is a discussion on Using Arrays in PHP within the PHP Programming forums, part of the Web Development category; ArrayIterator::valid ArrayIterator::valid -- Check whether array contains more entries Description bool ArrayIterator::valid ( void ) This function checks if the ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#21
| |||
| |||
| ArrayIterator::valid ArrayIterator::valid -- Check whether array contains more entries Description bool ArrayIterator::valid ( void ) This function checks if the array contains any more entries. ArrayIterator::valid() example <?php $array = array('1' => 'one'); $arrayobject = new ArrayObject($array); $iterator = $arrayobject->getIterator(); var_dump($iterator->valid()); //bool(true) $iterator->next(); // advance to the next item //bool(false) because there is only one array element var_dump($iterator->valid()); ?>
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:54 PM. |
|
#22
| |||
| |||
| ArrayObject::append ArrayObject::append -- Appends the value Description void ArrayObject::append ( mixed newval )
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:54 PM. |
|
#23
| |||
| |||
| ArrayObject::__construct ArrayObject::__construct -- Construct a new array object Description ArrayObject ArrayObject::__construct ( mixed input ) This constructs a new array object. The input parameter accepts an array or another ArrayObject. ArrayObject::__construct() example <?php $array = array('1' => 'one', '2' => 'two', '3' => 'three'); $arrayobject = new ArrayObject($array); var_dump($arrayobject); ?> The above example will output: object(ArrayObject)#1 (3) { [1]=> string(3) "one" [2]=> string(3) "two" [3]=> string(5) "three" }
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:55 PM. |
|
#24
| |||
| |||
| ArrayObject::count ArrayObject::count -- Return the number of elements in the Iterator Description int ArrayObject::count ( void )
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:56 PM. |
|
#25
| |||
| |||
| ArrayObject::getIterator ArrayObject::getIterator -- Create a new iterator from an ArrayObject instance Description ArrayIterator ArrayObject::getIterator ( void ) This function will return an iterator from an ArrayObject. ArrayObject::getIterator() example <?php $array = array('1' => 'one', '2' => 'two', '3' => 'three'); $arrayobject = new ArrayObject($array); $iterator = $arrayobject->getIterator(); while($iterator->valid()) { echo $iterator->key() . ' => ' . $iterator->current() . "\n"; $iterator->next(); } ?> The above example will output: 1 => one 2 => two 3 => three
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:56 PM. |
|
#26
| |||
| |||
| ArrayObject::offsetExists ArrayObject::offsetExists -- Returns whether the requested $index exists Description bool ArrayObject::offsetExists ( mixed index )
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:57 PM. |
|
#27
| |||
| |||
| ArrayObject::offsetGet ArrayObject::offsetGet -- Returns the value at the specified $index Description bool ArrayObject::offsetGet ( mixed index )
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:58 PM. |
|
#28
| |||
| |||
| ArrayObject::offsetSet ArrayObject::offsetSet -- Sets the value at the specified $index to $newval Description void ArrayObject::offsetSet ( mixed index, mixed newval )
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:58 PM. |
|
#29
| |||
| |||
| ArrayObject::offsetUnset ArrayObject::offsetUnset -- Unsets the value at the specified $index Description void ArrayObject::offsetUnset ( mixed index )
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:59 PM. |
|
#30
| |||
| |||
| CachingIterator::hasNext CachingIterator::hasNext -- Check whether the inner iterator has a valid next element Description bool CachingIterator::hasNext ( void )
__________________ Thanks & Regards Sabari... Last edited by Sabari : 08-21-2007 at 09:59 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Jagged Arrays in C# | vigneshgets | C# Programming | 4 | 09-30-2008 03:48 AM |
| Using arrays in stored procedures | it.wily | Database Support | 2 | 02-09-2008 09:18 AM |
| Classic asp arrays and recordset | ramesh123 | ASP and ASP.NET Programming | 1 | 12-02-2007 07:44 PM |
| Arrays in Java | leoraja8 | Java Programming | 7 | 11-19-2007 12:23 AM |
| Java:Tutorial - Arrays | pranky | Java Programming | 0 | 02-23-2007 11:54 PM |
Our Partners |