Re: Help with references?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is one that does not throw an error but does not produce the
desired results
class dir {

  var $name;
  var $subdirs;
  var $files;
  var $num;
  var $prio;

  function dir($name,$num,$prio) {
    $this->name = $name;
    $this->num = $num;
    $this->prio = $prio;
    $this->files = array();
    $this->subdirs = array();
  }

  function addFile($file) {
    $this->files[] =& $file;
    return $file;
  }

  function addDir($dir) {
    $this->subdirs[] =& $dir;
    return $dir;
  }

  function findDir($name) {
      foreach($this->subdirs as $v){
        if($v->name == $name)
          return $v;
      }
      return false;
  }

  function draw($parent) {


echo('d.add('.$this->num.','.$parent.',"'.$this->name."\",".$this->prio.");\n");

  foreach($this->subdirs as $v) {
      $v->draw($this->num);
On Sat, 2005-01-29 at 04:20 +0100, Jochem Maas wrote:
> Jon wrote:
> > This script only outputs the top level. i.e.
> > 
> 
> that script has syntax errors. ...
> 
> $arFiles = array(
>    array['file1'](
>      array(
>        ['path] => array(
>          [0] => 'folder1',
>          [1] => 'subfolder1'
>          [2] => 'file1.ext'
>      ),
>      ['length'] => 5464,
>      ['size'] => 8765
>    ),
>    array['file2'](
>      array(
>        ['path] => array(
>          [0] => 'folder2',
>          [1] => 'subfolder2'
>          [2] => 'file2.ext'
>      ),
>      ['length'] => 5464,
>      ['size'] => 8765
>    ),
>    array['file3'](
>      array(
>        ['path] => array(
>          [0] => 'folder3',
>          [1] => 'subfolder3'
>          [2] => 'file3.ext'
>      ),
>      ['length'] => 5464,
>      ['size'] => 8765
>    )
> )
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux