3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class Ymodulus { /** * This properties is meant to hold a list of new comers */ public $newComers; /** * This method is meant to determine if a student is in the list of newcomers *@Param string $newComer | i casted the variable to always return a string. *@return boolean. true|false. true if name is in list of newComers and false if its not. */ public function welcomes(string $newComer) { # here i am checking for the user inputed name in the array. Note am using the short form of if / else statement. return (in_array($newComers, $this->newComer)) ? true : false; } } //Usage $ymodulus = new Ymodulus(); $ymodulus->newComers =['MizMyColi', 'other New Bie']; $result = Ymodulus->welcomes('MizMyColi'); echo ($result === true ) ? 'MizMyColi Ymodulus welcomes you too the world of php': 'sorry not yet welcomed by ymodulus'; ?>

preferences:
31.85 ms | 402 KiB | 5 Q