Jump to content

johndapunk

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

johndapunk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am having a little problem understanding the logic behind this. I study some code (occasionally), and I saw this in IPB's scripts. At the begining of a class, it will have: PHP Code: [code]<?php class classname { var $ipsclass; ... } ?>[/code] and then later on, it is able to use the $ipsclass object like so: PHP Code: [code]$this->ipsclass->...[/code] I just don't understand how it uses the $ipsclass object without declaring something like: [code]$this->ipsclass = new ipsclass;[/code] Here, I'll post my code so you might get a better point of it. super.php: PHP Code: [code]<?php /** * Test Super Class * */ global $SUPER; $SUPER = new super; REQUIRE_ONCE( 'test_three.php' ); class super { public $num; function __construct( ) {     $this->num = 5;     } } ?>[/code] test_three.php: PHP Code: [code]<?php /** * Test Three * */ class three { public function f( $x ) {     $f = 5 * intval( $x );     echo $f; } } $three = new three; $three->f( $super->num ); ?>[/code] And it echos "0", which obviously means that $super->num in test_three.php is undefined. I have tried to figure out how it does it, but I still don't understand. If you get what I'm asking, please respond. If you think you might know the answer, but don't really understand the question, please IM me at jondapunk (AIM), or johndapunk@hotmail.com (MSN).
×
×
  • 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.