PHP treats zero (0) as empty . How we can differentiate between zero and empty variable ? — August 8, 2018

PHP treats zero (0) as empty . How we can differentiate between zero and empty variable ?

Yep I was caught in this situation too.But solution is simple.
We cant use empty() to differentiate between 0 and empty variable. empty() returns true for both.
Easy solution is function

is_numeric()

This will only return true is the variable is Numeric. Check this link for better explanation.

Advertisements
Laravel 5.6 assign value to variable in blade template — May 21, 2018
laravel 5.6 show last executed query — May 20, 2018
laravel install doctrine/dbal —
Laravel 5.6 reset user password manually — May 5, 2018
wordpress Because your install is not new, the sites in your WordPress network must use sub-domains — April 30, 2018
Wordpress Ubuntu not able to create directory — April 18, 2018

Wordpress Ubuntu not able to create directory

There can be several reasons for this. One of those can be the file ownership issue. Explaining a way to solve it

First of all check which server user is accessing your files. You can check it by

echo exec('whoami');

Now go to your server terminal and change ownership of your wordpress installation directory to this user or group. In ubuntu like this

sudo chown -R user:group /var/www/wordpress

Other issue can be the file and directory permission issue. You can make directory permission to 755 or 775. So a user or user-group can create/edit/delete files from directories. You can do it this way.

find /var/www/wordpress -type d -exec chmod 755 {} \;

OR

find /var/www/wordpress -type d -exec chmod 775 {} \;