Discussion regarding the advance php. Please tell me how to show results from sublime text

<?php trait demoTrait(){ funtion demofuntion1(){ rturn "this is demo funtion 1 in demo trait"; } } class democlass{ Use demoTrait; } $obj= new democlass; echo$obj->demofuntion1(); ?>

There are mistake in your code, Check video many times.

<?php
       trait demoTrait{ 
        function demofuntion1(){ 
            return "this is demo function 1 in demo trait"; }
        } 
        class democlass{ 
            Use demoTrait; 
        } 
        $obj= new democlass; 
        echo $obj->demofuntion1(); 

?>

Your mistake is
trait demoTrait(){ - extra use is () it should be - trait demoTrait{
funtion demofuntion1(){ - missing character c it should be - function demofuntion1(){
rturn - missinc e it should be - return
echo$obj->demofuntion1(); - should space after echo - echo $obj->demofuntion1();

1 Like

To understand the best concept about it to remove this code mistake check here to get more information about it.