Legal stuff about this site and your private life:

  • We use a cookie to keep your preferences (language, NSFW status, login status) during navigation.
  • We use your local storage to save the announces you closed (like this one).
  • We don't save informations you don't give
  • We don't share your email address if you comment or register
  • There is no tracker of any kind.

If you're not OK with this, move your way.

When I tried to get this website working, the server running PHP5.4 threw me this error: Can't use method return value in write context.

Then, I found this StackOverflow comment from Kornel...

He stated that:

However, the real problem you have is that you use empty() at all, mistakenly believing that "empty" value is any different from "false".

Empty is just an alias for !isset($thing) || !$thing. When the thing you're checking always exists, the empty() function is nothing but a negation operator.

Here is a small benchmark I made to demonstrate it:

<?php
/*
 * Testing empty() VS negation '!'
*/

// Array of value
$var = [null, true, false, 0, 1, '0', '1', ''];
foreach ($var as $v) {
  debug([empty($v), !$v]);
}


/*
 * Outputs
*/

//null
[
	(int) 0 => true,
	(int) 1 => true
]

// true
[  
	(int) 0 => false,
	(int) 1 => false
]

// false
[  
	(int) 0 => true,
	(int) 1 => true
]

// 0 
[
	(int) 0 => true,
	(int) 1 => true
]

// 1
[
	(int) 0 => false,
	(int) 1 => false
]

// '0'
[
	(int) 0 => true,
	(int) 1 => true
]

// '1'
[
	(int) 0 => false,
	(int) 1 => false
]

// ''
[
	(int) 0 => true,
	(int) 1 => true
]

Leave a comment

You want to react to this content or ask something to the author? Just leave a comment here!

Note that the comments are not publicly visible, so don't worry if you don't see yours.

All the information you give will only be visible to the author. We don't share anything with anyone.

Don't fill this field if you want this form to be saved.