Tag: PHP

How to run multiple PHP version with XAMPP on windows Side By Side

Some time we are in a situation where we badly need another PHP version to check our projects in local machine. We have some solutions too for this like Vagrant or Docker which provides us virtual environment. But for some one who heard it first time or in a hurry what will be the solution … Continue reading

How to call non static method from static method in PHP?

If the instance of your class is rarely needed, you can have the static method create an instance, call the non-static method and return the value.

How to use two traits with duplicate method in PHP?

We can easily use multiple traits with duplicate method name with instance of like as follow

How to check a remote file exist or not?

Sometimes we need to check whether a remote files exist or not? Most of the time we need it for remote image. We can do it very easily in PHP (v >=5.3.0 ), here is the sample code. $file_headers = @get_headers( ‘http://example.com/image.jpg’ ); if( strpos( $file_headers[0], ‘ OK’ ) !== false ){ // THE IMAGE … Continue reading