Object Oriented Programming and initializing an array.

Hello there,
I’m a beginner in PHP and trying to wrap my head around OOP.
I have the following problem with a test scipt, I declare an array variable and when I want to process it it will give me the following error:
Warning: Variable passed to each() is not an array or object in /Users/Kingma/Sites/oop_test/oop/page.class.php on line 52.
Probably something wrong with initiating the variable but I cannot figure out what I am doing wrong:
Partial code is below:
[php]

<?php class Page { //atributes for the class Page public $content; public $title = "I am Object Oriented"; public $keywords = "OOP, Programming, Object Oriented"; public static $nav_button = array("Home"=>"index.php", "Photos"=>"photos.php"); //this is not recognized as array further in the script // Operations for Page public function __set($name, $value) { $this -> $name = $value; } public function Display() { echo " \n \n"; $this -> DisplayTitle(); $this -> DisplayKeywords(); $this -> DisplayStyles(); echo " \n \n"; $this -> DisplayHeader(); $this -> DisplayNav(); // function concerned echo $this -> content; $this -> DisplayFooter(); echo " \n \n"; } // below is the function which gives the warning public function DisplayNav() { echo ""; echo "
    DisplayNavButton($name, $url, !$this -> IsURLCurrentPage($url)); } echo "
\n"; } [/php] Can anyone give me a hint for what I am doing wrong, can't figure it out. Best regards, Jelger
Sponsor our Newsletter | Privacy Policy | Terms of Service