Je me mets trankilou à la POO et mon tuto me renvoie une erreur alors que j'ai bien lu, bien retappé et même fait un copier coller pour m'assurer du code.
C'est issu de : http://www.apprendre-php.com/tutoriels/ ... bjets.html
Ce tuto est bon ? Vous avez autre chose à me conseiller ?
J'ai essayé le fameux hello world, arghh :
ma classe :Parse error: syntax error, unexpected T_PRINT, expecting T_STRING in C:\wamp\www\poo\HelloWorld.php on line 3
Code : Tout sélectionner
<?php Class HelloWorld {
public $word;
public function print(){
echo $this->word;
}
}
?>Code : Tout sélectionner
<?php require_once("HelloWorld.php");
$foo = new HelloWorld(); //instantiate the object
$foo->word = 'Hello, the world needs a hero';
$foo->print();
?> Metalliquement,
Megadeth