|
Posted by andre rodier on 04/17/07 08:08
Steve wrote:
> | class object
> | {
> | var $lines ;
> | var $posFound ;
> |
> | function object()
> | {
> | $lines = array( ... ) ;
> | ...
> | }
> |
> | function Search($val)
> | {
> | /* Line with error : */
> | array_walk($this->lines, 'searchInLines', $val );
> |
> | /* solution : */
> | array_walk($this->lines, array( $this,'searchInLines'), $val );
> | }
> |
> | function searchInLines(&line, $id, $valueToSearch)
> | {
> | if ( $line[$id] == $valueToSearch )
> | $this->posFound = $id ;
> | }
> | }
>
> you are aware that &line in searchInLines needs to be &$line...AND that you
> are treating it like the array itself when it is actually the VALUE of the
> array at key $id...otherwise searchInLines will never set posFound (which
> you should do when declaring it anyway).
>
> :)
>
Sorry, I have tried to simplify the original function by removing some
lines of code. You can find the original code on the application
'bildo', available here : http://bildo.tuxfamily.org/versions/working/
The file is 'albums/engines/index-dat.php'
But the code works, of course.
You can see a demo here : http://hubix.free.fr/bildo/index.php
Navigation:
[Reply to this message]
|