Did you ever tried to get mime type of the returned content in CURL! I was writing a small application for something and thought to know the Content-Type (mime type) of the response data returned by CURL’s exec(). Before thinking of anything else, I habitually started Goggling and found this… READ MORE
CSV is very common format for data interchange. It is not as famous as XML and JSON but it is always easy to work with. CSV file can be opened directly in MS Excel and readable in any text editor. It does not take as much space as XML takes.… READ MORE
PHP function – get_defined_constants() gives all the constants defined in current scope. It can be CORE Constants, extensions defined constants and user defined constants. As a developer you may be interested in all defined constants or user defined constants at a time. As the total number of constants printed on… READ MORE
Recently I need to use file for caching little bit of data. Then I thought of concurrency problem can arise in File based structure due to read/write issue. For small data and that also if not so useful , usage of Database can be avoided. Though Database can handle any… READ MORE
It is little difficult to get the right path in PHP sometime. PHP gets the path based on top page. To get the right path two functions are very useful – getcwd() and realpath(). To get what PHP is understanding of your supplied path for require/include, use realpath(). It will… READ MORE
I need to get all the parent folders of a File for a work. I searched on net to find easy solution for this and also to find some tips for my work. As, my work was heavily dependent on this logic, so I have given some time to it.… READ MORE
Here is an online HTML characters encoding tool I have created for those who post script on a blog or webpage. It will convert all the <, >, ‘ and ” characters to html entities.
I was doing it manually everytime by searching < and replacing it with > and… READ MORE
Want to know how many files are included in the current PHP script? Multiple files can be included in a single include file on a PHP script using include(), include_once(), require() and require_once().
- A.php
includes B.php
B.php
includes C.php, D.php etc
Now, file1.php can have multiple files and few… READ MORE
Included/required files will be searched in include path when not found in current directory or given path. This Path will act like a default path for all files included using include, require, require_once and include_once.
For lots of files residing in a deep directory and you want to set include… READ MORE
There are plethora of variables which can hold the Visitor IP address. One such variable is $_SERVER["REMOTE_ADDR"].
REMOTE_ADDR looks more close to our task as it has ‘remote’ inside it. But this variable can hold the private LAN IP address of the client machine’s server network and which is not… READ MORE