PHP: Popular code

Function to Get mime type By PHP

This function accepts single parameter $file which specifies the path of the file which MIME details to be find. Return Value: This function returns the MIME content type or False on failure

Check if a string contains a specific word

You can use the strpos function which is used to find the occurrence of one string inside another one or Find the position of the first occurrence of a substring in a string

Get the client IP address by PHP

There are several HTTP headers like X-Forwarded-For which may or may not be set by various proxies. The problem is that those are merely HTTP headers which can be set by anyone

Get the full URL By PHP

To get the current page URL, PHP provides a superglobal variable $_SERVER. The $_SERVER is a built-in variable of PHP