What are some methods to protect PHP code from being accessed by clients?

One method to protect PHP code from being accessed by clients is to move sensitive code outside of the web root directory, so it cannot be directly accessed via a URL. This prevents clients from viewing the PHP code by simply typing in the file path in their browser. Another method is to use .htaccess files to restrict access to specific directories or files. Additionally, you can use PHP's built-in encryption functions to obfuscate your code, making it more difficult for clients to understand.

```php
// Example of moving sensitive code outside of the web root directory
// Place this code in a file located outside of the web root directory

<?php
include('/path/to/secure-file.php');
// Your sensitive code here
?>

// Example of using .htaccess to restrict access to a directory
// Place this code in a .htaccess file in the directory you want to protect

Deny from all

// Example of using PHP encryption functions to obfuscate code
// Place this code at the beginning of your PHP file

<?php
$encrypted_code = base64_decode('encoded_code_here');
eval($encrypted_code);
?>