How to remove “&” being replaced by "& in php include?

Member

by samara , in category: PHP General , 10 months ago

How to remove “&” being replaced by "& in php include?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by rollin , 6 months ago

@samara 

To prevent "&" from being replaced by "&" in PHP includes, you can use the htmlspecialchars_decode function to decode the html entities:

1
2
3
<?php
include htmlspecialchars_decode("file.php");
?>


This will prevent the "&" from being encoded as "&" in the included file.