Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/05/2015, 11:01
Avatar de NSD
NSD
Colaborador
 
Fecha de Ingreso: mayo-2012
Ubicación: Somewhere
Mensajes: 1.332
Antigüedad: 12 años
Puntos: 320
$this->test_prop::$static_prop; Error.

Hola, el titulo lo dice, este es el problema:
Código PHP:
<?php 
    
class Test {
        public static 
$static_prop "Prueba";
    }
    
    class 
Main {
        private 
$test_prop null;
        public function 
__construct() {
            
$this->test_prop = new Test();
        }
        
        public function 
say() {
            return 
$this->test_prop::$static_prop;
        }
    }
    
    
$main_object = new Main();
    
    echo 
$main_object->say();
Cita:
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in test.php on line 13
¿Alguien sabe como es la sintaxis correcta para hacer eso?
__________________
Maratón de desafíos PHP Junio - Agosto 2015 en FDW | Reglamento - Desafios