Welcome Guest, Not a member yet? Register   Sign In
Variable Issues..........[Help]
#3

[eluser]Kanra[/eluser]
[quote author="mddd" date="1271157418"]When you call a Class variable, you have to use $this->$birthdayData. Not just $birthdayData. That will have no value.[/quote]

Thank you very much for your reply~

My problem is that I can not even assign value to these two variables
as soon as i run the code, it tells me following message

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in ......application\controllers\TXTU\reg.php on line 4

I don't know why.... I tried to add $this infront of the declaration
e.g. $this->$currentYear = date("Y") - 5;

and it still complains~~

Code:
<?php
class Reg extends Controller
{
    $currentYear = date("Y") - 5;
    $birthdayData = array("year"=>$currentYear, "i"=>0, "firstThru"=>TRUE);

    function Reg()
    {    
        //Constructor
        parent::Controller();
        $this->load->helper(array('form', 'url', 'date'));
        $this->load->library(array('form_validation', 'encrypt'));
    }
}
?>


Messages In This Thread
Variable Issues..........[Help] - by El Forum - 04-12-2010, 05:07 PM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 12:16 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 01:32 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 01:40 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 02:00 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 02:03 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 02:12 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 02:34 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 02:35 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 02:36 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 02:40 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 03:37 AM
Variable Issues..........[Help] - by El Forum - 04-13-2010, 04:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB