diff options
Diffstat (limited to 'test/scanners/php/class.in.php')
-rw-r--r-- | test/scanners/php/class.in.php | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/test/scanners/php/class.in.php b/test/scanners/php/class.in.php deleted file mode 100644 index bfc9e2d..0000000 --- a/test/scanners/php/class.in.php +++ /dev/null @@ -1,83 +0,0 @@ -<!-- from http://www.php.net/manual/en/keyword.class.php --> -<?php -class Cart { - var $items; // Items in our shopping cart - - // Add $num articles of $artnr to the cart - - function add_item($artnr, $num) { - $this->items[$artnr] += $num; - } - - // Take $num articles of $artnr out of the cart - - function remove_item($artnr, $num) { - if ($this->items[$artnr] > $num) { - $this->items[$artnr] -= $num; - return true; - } elseif ($this->items[$artnr] == $num) { - unset($this->items[$artnr]); - return true; - } else { - return false; - } - } -} -?> - - -<?php -class Cart { - /* None of these will work in PHP 4. */ - var $todays_date = date("Y-m-d"); - var $name = $firstname; - var $owner = 'Fred ' . 'Jones'; - /* Arrays containing constant values will, though. */ - var $items = array("VCR", "TV"); -} - -/* This is how it should be done. */ -class Cart { - var $todays_date; - var $name; - var $owner; - var $items = array("VCR", "TV"); - - function Cart() { - $this->todays_date = date("Y-m-d"); - $this->name = $GLOBALS['firstname']; - /* etc. . . */ - } -} -?> - -<?php -class A -{ - function foo() - { - if (isset($this)) { - echo '$this is defined ('; - echo get_class($this); - echo ")\n"; - } else { - echo "\$this is not defined.\n"; - } - } -} - -class B -{ - function bar() - { - A::foo(); - } -} - -$a = new A(); -$a->foo(); -A::foo(); -$b = new B(); -$b->bar(); -B::bar(); -?> |