Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of Python's None singleton in PHP?

Tags:

python

syntax

php

How do you represent the concept of "undefined" in PHP?

SQL has "NULL", Python has "None", what is the equivalent in PHP?

[updated]

Tanks everybody for the enlightening discussion (cHao, had you written a response rather than a comment I would choose yours).

like image 752
Paulo Scardine Avatar asked Dec 19 '25 23:12

Paulo Scardine


1 Answers

Php has NULL too

Taken from the docs

The special NULL value represents a variable with no value. NULL is the only possible value of type NULL.

A variable is considered to be null if:

  • it has been assigned the constant NULL.

  • it has not been set to any value yet.

  • it has been unset().

like image 134
Nicola Peluchetti Avatar answered Dec 21 '25 13:12

Nicola Peluchetti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!