fork download
  1. <?php
  2.  
  3. final class User {
  4. public function welcome() {
  5. return "Welcome User";
  6. }
  7.  
  8. final public function role() {
  9. return "Role: Normal User";
  10. }
  11. }
  12.  
  13. /*
  14. ❌ هذا الكود غير مسموح
  15. class Admin extends User { }
  16. */
  17.  
  18. class Test {
  19. public function show() {
  20. $user = new User();
  21. return $user->welcome() . " | " . $user->role();
  22. }
  23. }
  24.  
  25. $test = new Test();
  26. echo $test->show();
  27.  
  28. ?>
Success #stdin #stdout 0.02s 25584KB
stdin
Standard input is empty
stdout
Welcome User | Role: Normal User