Using the built in PHP regex function preg_replace and property encoding the two strings you’re searching for with preg_quote you can remove all of the
Strip Image EXIF Data
Many times you’ll want to remove the meta data on user uploaded images to your website. The meta data automatically saved to the images can
Function To Remove All Cookies For The Domain
This PHP function will delete all valid cookies for a domain. We’re also sanitizing the cookie variable names from invalid characters.
How to do Email Validation
Using the PHP filter_var function we can test email addresses for valid format and only unicode characters. Example usage below.
Replace All Characters In a String that Aren’t Alphanumeric
Using the preg_replace function you can easily replace all characters in a string that are not alphanumeric. This can be useful for sanitizing a string
How To Check the SHA Hash of Files
When you download software online often the publisher will also provide a file hash to make sure that the file hasn’t been modified or hacked
htmlentities() versus htmlspecialchars() – What’s Better For Emitting HTML?
Both htmlentities and htmlspecialchars work the same way in that they are used to emit a string of user input that may contain raw HTML
How to Diff Two Strings and Show the Difference in HTML
This php class will take two strings and return a html diff of them with the <ins> and <del> html tags representing what was deleted
How to Test a Date for Validity
Needed a function to test if a date was valid in PHP. This function does that but it also requires an expected date format. Example
Function to Remove Dollar Signs and Commas From a Number
I needed a function to turn a string value dollar with commas into a decimal I could insert into MySQL. This function below will take