Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199903

RE: [PHP3] Objects From: Andrew Smith (asmith <email protected>)
Date: 03/18/99

Mark Derricutt Wrote:
> Hi, could someone post some example code on creating objects with PHP?
> I'd tried a simple function using object_init and add_property_string
> and stuff but it didn't want to work :(

<?PHP
  class demonstration {
    var $msg = "";
    function demonstration($MSG) {
      echo "Demo class initialised<BR>\n";
      $this->msg = $MSG;
    }

    function proveIt($param) {
      echo "hey I'm here and when you initialised me you sent me".
           " this message: \"$this->msg\"<BR>\n";
      echo "plus you called this function with the parameter:".
           " \"$param\"<BR>\n";
    }
  }
  $demo = new demonstration("Hi There");
  $demo->proveIT("Wow it worked");
?>

Never used object_init and add_property_string so can't help u with those
functions tho

Andrew

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>