Skip to content

DevtheWeb.NET's Blog » Blog Archive » Things You Probably Didn’t Know About PHP

Link To Full Story: www.devtheweb.net

I’ve spend some time reading about cool things in PHP. I found some interesting functions and tricks. Here’s the list:

1. You can compress/decompress long strings before storing them in a database. It can be done very easy using the built-in functions: gzcompress() and gzuncompress(). They use gzip algorithm and could compress a string up to 90%.

2. You can check if a email is valid by the checkdnsrr() function. It checks the email’s host address if it’s a valid DNS record.

For ex. tihomir@devtheweb12782.com is semantically a valid e-mail, but devtheweb12782.com is not a valid host. That’s why checkdnsrr() will return false.

3. Output formatted PHP code, you can do it by using the highlight_file() function. This function will return a HTML formatted string with nicely colored PHP inside it.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*