PHP: Get the PHP extension name of a class by the class name
$class_name = 'DOMDocument'; $class = new ReflectionClass($class_name); $extension = $class->getExtension(); echo $extension;
$class_name = 'DOMDocument'; $class = new ReflectionClass($class_name); $extension = $class->getExtension(); echo $extension;
$extension_name = 'dom'; $extension = new ReflectionExtension($extension_name); print_r($extension->getFunctions()); print_r($extension->getClassNames());
$function_name = 'imagecreate'; $class = new ReflectionFunction($function_name); $extension = $class->getExtension(); echo $extension;
The following PHP function will help you easily convert IPv4(IP address version 4) to IPv6(IP address version 6). The function will return false if the provided IP address is invalid…
Below is a snippet of the code and usage guide. PHP Function function colourBrightness($hex, $percent) { // Work out if hash given $hash = ''; if (stristr($hex, '#')) { $hex…
Well, first rule – you should not do this. But if there is good reason, consider using such query for searching in index-based arrays: In case you have assoc array…
Assuming your date column is an actual MySQL date column: SELECT * FROM jokes WHERE date > DATE_SUB(NOW(), INTERVAL 1 DAY) ORDER BY score DESC; SELECT * FROM jokes WHERE…
This article focuses on how to simply and efficiently converse with Envato’s API in order to verify the authors’ customers’ purchase codes in the author’s own applications. I talk through…
Verify hex color string This PHP script checks if a string $color is a hex color or not. The second IF statement will add the pound symbol at the beginning…
The script below loops over the specified directory and chmods its files, directories and subdirectories recursively.