spl

Retrieve the key value from a arrayObject

This is my array: ArrayObject::__set_state( array( 'data' => array ( 'key1' => '573779', 'key2' => 'REF12345', 'key3' => '2010-07-12', 'key4' => '0000-00-00', 'key5' => '2010-07-12', 'key6' => '21654', 'key7' => '0', 'key8...

Help Using RegexIterator in PHP

I have yet to find a good example of how to use the php RegexIterator to recursively traverse a directory. The end result would be I want to specify a directory and find all files in it with some given extensions. Say for example only html/php extensions. Furthermore, I want to filter out folders such of the type .Trash-0, .Trash-50...

RecursiveIteratorIterator last child

I iterate through a multidimensional array with RecursiveIteratorIterator and would like to be able to know if the current element is the last child of it's depth. I thought about this: $iterator = new RecursiveIteratorIterator($array, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $val) { $next = clone $iterator;...

HaXe + PHP: "Cannot redeclare _hx_add()"

Background I'm porting markdown to HaXe. Problem HaXe's PHP generator is either totally borked, or I've done something wrong. When I try to include the generated php file containing main(), I get an error like this: Fatal error: Cannot redeclare _hx_add() (previously declared in /home/owner/Projects/mdown/build/php/lib/php/Boot.cl...

Where can I find a downloadable prescription and OTC drugs database?

I am working on a project for (US based) online pharmacies and I am having a hard time finding a database of drugs grouped by layman categories. I downloaded FDA data from 'Drugs@FDA' and 'Facts@FDA'. It contains a wide list of approved medications but is not sorted/grouped by layman categories like you would find in online search libr...

Iterating over multi-level ArrayObject() to print out on-screen hierarchical view

Hi, I have a ArrayObject structure that is quite complex to output, it can/and consists of multiple levels of relationship e.g. Parent -> Child -> Children -> Child etc. Structures like this are quite complex to work with when using a foreach, for or while loop. I've looked into SPL Iterators and I think this can be used. I'm a bit unf...

Accessing array object variables when implementing RecursiveArrayIterator in RecursiveIteratorIterator

I have a large arrayObject which I'm looping over using the following:- $rit = new RecursiveIteratorIterator(new RecursiveArrayIterator($hierarchy)); foreach($rit as $key=> $val) { } How can I access the a specific key within the array? I can access them by echoing $key and the $val but I have specific keys I wish to access. If I att...