Jump to content

fraginhell

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fraginhell's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Everyone, Please be gentle, i'm just starting to walk down the php path :) I'm trying to get my head round php classes. I've created a very simple class to get the size of a file. I have created a function to get the file size which works fine. However if I want to to this a default action when I create the class I added the function to the constructor, but php moans that it can find the function. My guess is either my logic is wrong or some thing to do with scope? (code below) any advice is welcomed at this point, while I still have hair ;) [code] <?php class fileInf {   var $file_name;   var $size;   function set_size()   {     filesize($this->file_name);   }   function get_size()   {     echo "File size is : " . $this->size;   }   function fileInf($filename)   {     $this->file_name=$filename;     set_size();   } } $myfile = new fileInf("c:\pagefile.sys"); $myfile->get_size(); ?> [/code] thanks again. Keith
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.