scottybwoy Posted September 6, 2006 Share Posted September 6, 2006 example :var $myTextColor = 'red';is var depreciated and is it even needed? Can it be used like so :$myTextColor = 'red';Thanks Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 6, 2006 Share Posted September 6, 2006 In a class the var is needed other wise get rid of it ok.link might help.http://uk.php.net/oopexample from link.[code]<?phpclass 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. . . */ }}?> [/code] Quote Link to comment Share on other sites More sharing options...
scottybwoy Posted September 6, 2006 Author Share Posted September 6, 2006 Great thanks for clearing that up Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.