0

I must convert a web application from php 5 to php 4, but I'm having some problems, especially with objects. I'm getting a error in a setter function with array arg (parse error, unexpected '=', expecting '(' on line 20). The code:

class Fecha extends DateTime {

    var $dias = array();

    function DateTime($fechaHora = 'now') {
        parent::__construct($fechaHora, new DateTimeZone('Europe/Madrid'));
    }

/*
 * Getters / Setters
 */

    function setDias($dias) {
        if (count($dias) == 7)   
            self::$dias = $dias;  // Here is where the error is thrown
    }
}

and I call the class like that:

Fecha::setDias(array('Luns', 'Martes', 'Mércores', 'Xoves', 'Venres', 'Sábado', 'Domingo'));
Kara
  • 6,115
  • 16
  • 50
  • 57
Sergio
  • 19
  • 1
  • 6
  • 1
    backporting php scripts is just wrong in every conceivable way. no matter why you think you have to do it, it is wrong and you should rather pay to upgrade the server. – Gung Foo May 29 '13 at 11:35

1 Answers1

0

Please provide more code.. According this you should use this:

static $dias = array();

function DateTime($fechaHora = 'now') {
    parent::__construct($fechaHora, new DateTimeZone('Europe/Madrid'));
}

/*
 * Getters / Setters
 */

function setDias($dias) {
    if (count($dias) == 7)   
        self::$dias = $dias;  // Here is where the error is thrown
}