Jump to content


Photo

varry simple var question ? *SOLVED*


  • Please log in to reply
2 replies to this topic

#1 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 06 September 2006 - 11:35 AM

example :

var $myTextColor = 'red';

is var depreciated and is it even needed?  Can it be used like so :

$myTextColor = 'red';

Thanks

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 September 2006 - 11:38 AM

In a class the var is needed other wise get rid of it ok.


link might help.

http://uk.php.net/oop

example from link.
<?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. . . */
   }
}
?>  

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 scottybwoy

scottybwoy
  • Members
  • PipPipPip
  • Advanced Member
  • 532 posts
  • LocationUK

Posted 06 September 2006 - 01:57 PM

Great thanks for clearing that up




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users