Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2012, 07:44 PM
Authorized User
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default difference between empty() and null?

what is the difference between the two? how can if(!empty($field)) return true, but the same variable, pass as false when asked if it's null?
 
Old February 28th, 2012, 11:55 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi there

you may need to see these links:

http://php.net/manual/en/language.types.null.php

http://php.net/manual/en/function.empty.php


think of 'null' as 'unassigned', and 'empty' as 'assigned but no value'. this sentences are not true at all but maybe help to remember difference.
__________________
happy every time, happy every where

Reza Baiat
 
Old July 18th, 2012, 06:44 AM
Registered User
 
Join Date: Jul 2012
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Quote:
Originally Posted by irProject View Post
Hi there

you may need to see these links:

http://php.net/manual/en/language.types.null.php

http://php.net/manual/en/function.empty.php


think of 'null' as 'unassigned', and 'empty' as 'assigned but no value'. this sentences are not true at all but maybe help to remember difference.
I was little bit in confusion about difference between empty() and null, i got me solution from above php.net link, thank you dude.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set Not Null constraint to Null Columns arasu Oracle 1 August 22nd, 2005 10:09 AM
0, Empty Strings and Null Loralee Access 8 August 10th, 2005 10:13 PM
Don;t diplay text box if it is empty or null abdul_wasie Classic ASP Databases 5 May 20th, 2005 11:49 PM
Difference between null and empty string shoakat Classic ASP Databases 4 September 10th, 2004 11:40 AM
search for null /String.Empty in Active Directory georgeh C# 1 October 16th, 2003 08:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.