Re: [PHP] SPL Recursive Iterator Examples

2013-03-19 Thread Alain Williams
On Tue, Mar 19, 2013 at 04:40:59AM -0700, NaMarPi wrote: > > > I have not found enough documents about Recursive Iterators on the net, so > started to collect my mini-examples here: > > > https://github.com/namarpi/PHP-SPL-Recursive-Examples If you are putting them up

[PHP] SPL Recursive Iterator Examples

2013-03-19 Thread NaMarPi
I have not found enough documents about Recursive Iterators on the net, so started to collect my mini-examples here: https://github.com/namarpi/PHP-SPL-Recursive-Examples -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] SPL RecursiveArrayIterator::offset(Un)Set has no effect on instance created with ArrayObject

2013-03-11 Thread NaMarPi
Hello All, It seems to me that an instance of RecursiveIteratorIterator with ArrayObject has no effect when calling RecursiveArrayIterator::offsetUnset or RecursiveArrayIterator::offsetSet methods. But everything works fine when the iterator is created with a json_decoded - json_encoded array.

Re: [PHP] SPL

2007-10-30 Thread Børge Holen
On Monday 29 October 2007 16:26:13 Jim Lucas wrote: > Børge Holen wrote: > > On Sunday 28 October 2007 07:27:53 you wrote: > >> Børge Holen wrote: > >>> I found this code at php.net witch needs very little modifications and > >>> can do so much, but I can't figure out how to make it read alphabetic

Re: [PHP] SPL

2007-10-29 Thread Jim Lucas
Børge Holen wrote: On Sunday 28 October 2007 07:27:53 you wrote: Børge Holen wrote: I found this code at php.net witch needs very little modifications and can do so much, but I can't figure out how to make it read alphabeticly as mentioned $it = new RecursiveDirectoryIterator($

Re: [PHP] SPL

2007-10-28 Thread Børge Holen
On Sunday 28 October 2007 15:37:21 Nathan Nobbe wrote: > i suppose this is what youre looking for ? > you can tailor it to your needs of course :) > > $it = new RecursiveDirectoryIterator('.'); > $isFirstDir = true; > $fileList = array(); > $dynfile = fopen('sortedFiles', 'w+'); > $theRecursiveIte

Re: [PHP] SPL

2007-10-28 Thread Nathan Nobbe
i suppose this is what youre looking for ? you can tailor it to your needs of course :) isDir()){ /// drop the name of the directory into the results fwrite($dynfile, 'Directory: ' . (string) $path . PHP_EOL); if($isFirstDir) { // just update t

Re: [PHP] SPL

2007-10-28 Thread Børge Holen
On Sunday 28 October 2007 07:27:53 you wrote: > Børge Holen wrote: > > I found this code at php.net witch needs very little modifications and > > can do so much, but I can't figure out how to make it read alphabeticly > > as mentioned > > > > $it = new RecursiveDirectoryIterator($_GET['

Re: [PHP] SPL

2007-10-28 Thread Børge Holen
On Sunday 28 October 2007 02:57:13 Jochem Maas wrote: > Børge Holen wrote: > > On Sunday 28 October 2007 01:32:15 you wrote: > >> On 10/27/07, Børge Holen <[EMAIL PROTECTED]> wrote: > >>> I'm currently using RecursiveDirectoryIterator and > >>> RecursiveIteratorIterator. > >>> I'm using fwrite to w

Re: [PHP] SPL

2007-10-27 Thread Jim Lucas
Børge Holen wrote: I found this code at php.net witch needs very little modifications and can do so much, but I can't figure out how to make it read alphabeticly as mentioned $it = new RecursiveDirectoryIterator($_GET['location']); foreach (new RecursiveIterato

Re: [PHP] SPL

2007-10-27 Thread Jochem Maas
Børge Holen wrote: > On Sunday 28 October 2007 01:32:15 you wrote: >> On 10/27/07, Børge Holen <[EMAIL PROTECTED]> wrote: >>> I'm currently using RecursiveDirectoryIterator and >>> RecursiveIteratorIterator. >>> I'm using fwrite to write to a file while parsing throught the file >>> structure, >>>

Re: [PHP] SPL

2007-10-27 Thread Børge Holen
On Sunday 28 October 2007 01:32:15 you wrote: > On 10/27/07, Børge Holen <[EMAIL PROTECTED]> wrote: > > I'm currently using RecursiveDirectoryIterator and > > RecursiveIteratorIterator. > > I'm using fwrite to write to a file while parsing throught the file > > structure, > > and was wondering if i

Re: [PHP] SPL

2007-10-27 Thread Nathan Nobbe
On 10/27/07, Børge Holen <[EMAIL PROTECTED]> wrote: > > I'm currently using RecursiveDirectoryIterator and > RecursiveIteratorIterator. > I'm using fwrite to write to a file while parsing throught the file > structure, > and was wondering if it is at all possible to sort alphabetical without > goin

[PHP] SPL

2007-10-27 Thread Børge Holen
I'm currently using RecursiveDirectoryIterator and RecursiveIteratorIterator. I'm using fwrite to write to a file while parsing throught the file structure, and was wondering if it is at all possible to sort alphabetical without going all array. That seems to me like doing the job twice over. Atl

Re: [PHP] spl DirectoryIterator

2007-04-08 Thread Jochem Maas
Matthew Dellar wrote: > I have a problem, > > I need to turn an iterator into an array, but when I do, some methods I > need to use stop working. why do you need to turn it into an array? maybe there is an alternative? my first reaction would be that if you really need an array then you'll probab

[PHP] spl DirectoryIterator

2007-04-07 Thread Matthew Dellar
I have a problem, I need to turn an iterator into an array, but when I do, some methods I need to use stop working. Take a look at the following example: $dir = 'c:/'; $files = new DirectoryIterator($dir); //$files = iterator_to_array($files); foreach ($files as $file) { echo "{$file->get

[PHP] SPL Iterator and Associative Array

2006-06-02 Thread Jason Karns
I'm going to try my best to explain what I'm trying to do. I have my own class that has an array member. This class itself implements Iterator. One of the fields in the array is itself an array that I would like to iterate over. Here's some code: class Folio implements Iterator { $projects = ar

Re: [PHP] SPL array filter

2005-09-09 Thread Robin Vickery
On 9/9/05, Kevin Waterson <[EMAIL PROTECTED]> wrote: > > Want to filter out cats from this array using SPL FilterIterator > $arr = array('koala', 'dingo', 'cat', 'Steve Irwin', 'fish'); > Why, what's wrong with cats? -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, vis

[PHP] SPL array filter

2005-09-08 Thread Kevin Waterson
Want to filter out cats from this array using SPL FilterIterator $arr = array('koala', 'dingo', 'cat', 'Steve Irwin', 'fish'); kind regrards Kevin -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." -- PHP General Mailin

Re: [PHP] Re: [SPAM] - RE: [PHP] SPL Countable count() not being called - Bayesian Filter detected spam

2005-08-30 Thread Chris
Justin Francis wrote: Jay Blanchard wrote: [snip] No. By implementing the Countable interface, and implementing the count() method, the global count($c) function is supposed to call $c->count(). This is so the object can be treated like a countable array in the same manner. [/snip] I was

[PHP] Re: [SPAM] - RE: [PHP] SPL Countable count() not being called - Bayesian Filter detected spam

2005-08-30 Thread Justin Francis
Jay Blanchard wrote: [snip] No. By implementing the Countable interface, and implementing the count() method, the global count($c) function is supposed to call $c->count(). This is so the object can be treated like a countable array in the same manner. [/snip] I was asleep earlierif $c

RE: [PHP] SPL Countable count() not being called

2005-08-30 Thread Jay Blanchard
[snip] No. By implementing the Countable interface, and implementing the count() method, the global count($c) function is supposed to call $c->count(). This is so the object can be treated like a countable array in the same manner. [/snip] I was asleep earlierif $c is not an array 1 will be

Re: [PHP] SPL Countable count() not being called

2005-08-30 Thread Stut
Justin Francis wrote: Stut wrote: Should it not be $c->count() ? -Stut No. By implementing the Countable interface, and implementing the count() method, the global count($c) function is supposed to call $c->count(). This is so the object can be treated like a countable array in the same

Re: [PHP] SPL Countable count() not being called

2005-08-30 Thread Justin Francis
Stut wrote: Justin Francis wrote: I have not been able to get count() to be called when I pass my Countable class to the count function. I am using PHP 5.1 Release Candidate 1. I am not sure if it is a bug, so I am posting here to see if anyone can help. -- class Col

Re: [PHP] SPL Countable count() not being called

2005-08-30 Thread Stut
Justin Francis wrote: I have not been able to get count() to be called when I pass my Countable class to the count function. I am using PHP 5.1 Release Candidate 1. I am not sure if it is a bug, so I am posting here to see if anyone can help. -- class Collection implem

RE: [PHP] SPL Countable count() not being called

2005-08-30 Thread Jay Blanchard
[snip] class Collection implements Countable { public function count() { return 200; } } $c = new Collection(); echo(count($c)); [/snip] Shouldn't this be echo Collection->count($c); or something like that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] SPL Countable count() not being called

2005-08-30 Thread Justin Francis
I have not been able to get count() to be called when I pass my Countable class to the count function. I am using PHP 5.1 Release Candidate 1. I am not sure if it is a bug, so I am posting here to see if anyone can help. -- class Collection implements Countable { public

Re: [PHP] SPL DirectoryIterator

2005-01-28 Thread Jochem Maas
Chris wrote: I'm not sure if this is a feature request, a "Oh, I didn't know that", or "That's the way it is, deal with it" kind of problem. iMHO its pretty much the last one, but I don't see the problem with what you have written, ok its a little longer, but you don't have to know that the magic

[PHP] SPL DirectoryIterator

2005-01-28 Thread Chris
I'm not sure if this is a feature request, a "Oh, I didn't know that", or "That's the way it is, deal with it" kind of problem. foreach(new DirectoryIterator($sDir) as $oFile) { if($oFile->isDot() || 'hidden.txt' == $oFile->getFilename()) continue; echo $oFile,"\n"; } In the code above, I a

[PHP] SPL Exceptions

2005-01-18 Thread Gerard Samuel
Does anyone know when the exception objects listed in item #6 at http://www.php.net/~helly/php/ext/spl/ will be available in base php5?? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php