How can PHP be used to split email addresses for spam protection while still maintaining functionality?

To split email addresses for spam protection while maintaining functionality, you can use PHP to obfuscate the email address by splitting it into parts and then concatenating it back together using JavaScript. This way, the email address is not easily recognizable by spam bots but can still be used by users.

<?php
$email = 'example@example.com';
$parts = explode('@', $email);
$obfuscated_email = $parts[0] . '@' . $parts[1];
?>

<script type="text/javascript">
document.write('<?php echo $obfuscated_email; ?>');
</script>