assign array to create new class object

  • 18 years ago

    I try to define a new object using class
    my PHP script goes below
    <?
     include('menu.php');
     function makemenu(){


       $data    = "data/link.dat";
       $file=fopen($data,"r")
               or die ("Sorry Dude, you can not open the specified file!");
       $i=0;
       //$tlinks=array();
       $head=array();
       while (!feof ($file)) {
         $line=fgets ($file, 2048);
         $values=explode("||", $line);


          if (($values[0] != " "))
          {
           $flag=substr($values[0],0,1);
              if (strtoupper($flag == "M") && ($values[1] != " ") && ($values[2] != " "))
              {
                array_push($head,substr($values[0],1));
                $head[$i]= new menu('<img src=\"button.php?fg=f00000&bg=dddddd&txt=\".$head[\".\"$i\".\"]" border=\"0\" >', '$head[$i]');
                $head[$i]->add('<img src="button.php?fg=666666&bg=eeeeee&txt=\".$values.\"[1].\"" border=\"0\" >', '$values[2]', 'main');
              }
         }  else
         {
           echo "nggak keluar ya menunya? he he ";
           exit;
         }
         $i++;
      }
     }
    ?>


    my question is , why this script isn't working properly


    $head[$i]= new menu('<img src=\"button.php?fg=f00000&bg=dddddd&txt=\".$head[\".\"$i\".\"]" border=\"0\" >', '$head[$i]');
    $head[$i]->add('<img src="button.php?fg=666666&bg=eeeeee&txt=\".$values.\"[1].\"" border=\"0\" >', '$values[2]', 'main');


    best regards

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity.” - Dennis Ritchie