PHP get class name without namespace
Below is the simple function to get class name without namesapce. public function getClassName() { $path = explode('\\', __CLASS__); return array_pop($path); }
Below is the simple function to get class name without namesapce. public function getClassName() { $path = explode('\\', __CLASS__); return array_pop($path); }
Here is simple PHP code snippet to check if a given number is odd or even. Check Number Is Odd Or Even function checkEven($val){ return
//here we have one php variable //In javascript/jQuery
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { /* This is one ajax call }
func_get_args() returns an array with all arguments of the current function. PHP5.6 – splat operator Arrays and Traversable objects can be unpacked into argument lists
The array_change_key_case() function changes all keys in an array to lowercase or uppercase. Syntax: array_change_key_case(array,case); array - The array to work on CASE_LOWER - Default
<?php $str="foo,bar,baz,bat"; $arr=explode(",",$str); // print_r($arr); ?>
Below function takes hex code (e.g. #eeeeee), returns array of RGB values. function hex2rgb( $colour ) { if ( $colour[0] == '#' ) { $colour
/** * Get google fonts * * @param integer $amount - Return a chuck of fonts * * @return Array of fonts */ function get_google_fonts(
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://devicecloud.digi.com/ws/v1/devices/inventory'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FLASE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FLASE); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, 'username:password'); $data = curl_exec($ch); curl_close($ch);