You are here: Re: Really hardcore question about PHP needed :) « PHP Programming Language « IT news, forums, messages
Re: Really hardcore question about PHP needed :)

Posted by Steve on 04/16/07 20:09

| 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).

:)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация