Deleting an element from an array in PHP

There are different ways to delete an array element, where some are more useful for some specific tasks than others. Deleting a single array element If you want to delete just one array element you can use unset() or alternatively \array_splice(). If you know the value and don’t know the key to delete the element you can use \array_search() to … Read more

Fatal error: Call to undefined function mysqli_connect()

For 2 days now I’m trying to solve this, but unfortunately no result. Let me tell you my story about the problem. I’ve bulid an application on a site, and the application deals with the reviews. But, I’m trying to put it on another site, and I copyed the php files, the sql file from … Read more

Make a HTTPS request through PHP and get response

this might work, give it a shot. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // Set so curl_exec returns the result instead of outputting it. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Get the response and close the channel. $response = curl_exec($ch); curl_close($ch); for more info, check http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/

PHP: $_SERVER variables: $_SERVER[‘HTTP_HOST’] vs $_SERVER[‘SERVER_NAME’]

$_SERVER[‘SERVER_NAME’] gives the value of the server name as defined in host configuration (i.e for Apache the Apache .conf file). $_SERVER[‘HTTP_HOST’] gives you the domain name through which the current request is being fulfilled and is more directly related to the request. HTTP_HOST is typically more useful in most applications in that it relates directly to the request, … Read more

When should I use ‘self’ over ‘$this’?

Short Answer Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members. Full Answer Here is an example of correct usage of $this and self for non-static and static member variables: Here is an example of incorrect usage of $this and self for non-static and static member variables: Here is an example of polymorphism with $this for member functions: Here … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)