Code Snippets

PHP Current Directory

How to get current directory, filename and code line number in PHP

In PHP, there are several built-in functions that can be used to obtain information about the current script’s directory, filename, and code line number. Getting the Current Directory To get the absolute path of the directory containing the current script, you can use the dirname(__FILE__) function. For example: This will set the $current_directory variable to […]

How to get current directory, filename and code line number in PHP Read More »

PHP error log - operator not supported

[] operator not supported for strings – PHP

I had a problem with Revolution Slider on a WordPress installation when upgrading to PHP 7.2+. It would generate the error – PHP Fatal error: [] operator not supported for strings in C:[path]\wp-content\plugins\revslider\includes\framework\base-admin.class.php:71 The problem was from the plugin attempting to use the short array push syntax on a string: The solution was to modify

[] operator not supported for strings – PHP Read More »

Display TIFF files on the web

Display Tiff Files on the Web [Updated for 2024]

Do you want to display TIFF files on the web?  You can learn how here. TIFF files are not made for the web and are not well suited for the web. They used to work in many browsers but as of this writing, support is waning:  http://en.wikipedia.org/wiki/Comparison_of_web_browsers#Image_format_support. TIFF files are very large and contain layer

Display Tiff Files on the Web [Updated for 2024] Read More »