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 Link to comment https://forums.phpfreaks.com/topic/19887-varry-simple-var-question-solved/ 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] Link to comment https://forums.phpfreaks.com/topic/19887-varry-simple-var-question-solved/#findComment-87018 Share on other sites More sharing options...
scottybwoy Posted September 6, 2006 Author Share Posted September 6, 2006 Great thanks for clearing that up Link to comment https://forums.phpfreaks.com/topic/19887-varry-simple-var-question-solved/#findComment-87105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.