Skip to content

Tag: php

Writing Array to File in php And getting the data

I have An array which looks like following after using print_r Now I want to write this array direct to a file, I use the file_put_contents method, but I don’t know how to get the data from the file exactly how they looks like original. Any idea to solve this? Answer Your problem at the moment is basica…

Create link in pdf with tcpdf

How can I create a link with TCPDF? When using the writeHTML() function and passing my whole html content, TCPDF doesn’t make my links clickable. They are blue and underlined but I cannot click them. Here is what I did. Answer As per the documentation, you can use the Write() method on your TCPDF object…

Replacing text between two limts

I have been trying to get the text between two symbols to be replaced with preg_replace, but alas still not quite getting it right as I get a null output that is empty string, this is what I have so …

Haversine formula with php

I want to use this formula with php. I have a database with some values of latitute and longitude saved. I want to find, with a certain value of latitude and longitude in input, all the distances (in km) from this point with each point in the database. To do this, I used the formula on googlemaps api: Of cour…

Fatal Error – Too many open files

I try to run PHPUnit Tests in my new machine and I get this error: PHP Fatal error: Uncaught exception ‘UnexpectedValueException’ with message ‘RecursiveDirectoryIterator::__construct(/usr/lib/php/pear/File/Iterator): failed to open dir: Too many open files’ in /usr/lib/php/pear/File/I…