Ghh - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of Ghh.php

  1. <?php
  2.  
  3.  
  4. function paywall_check_user_roles(){
  5.         $roles = ['subscriber', 'administrator', 'editor', 'author', 'contributor'];
  6.         $allowed_roles = ['subscriber', 'administrator', 'editor', 'author', 'contributor'];
  7.        
  8.     $is_user_logged_in = false;
  9.     
  10.     if($is_user_logged_in){
  11.             if(!empty(array_intersect($allowed_roles, $roles))){
  12.                 return true;
  13.         }
  14.         else {
  15.                 return false;
  16.         }
  17.     }
  18.     else {
  19.             return false;
  20.     }
  21. }
  22.  
  23. print(paywall_check_user_roles());
File Description
  • Ghh
  • PHP Code
  • 29 Nov-2022
  • 493 Bytes
You can Share it: