L
L
Leonid Gorshkov2018-04-30 20:21:32
PHP
Leonid Gorshkov, 2018-04-30 20:21:32

$_GET(value "0") not accepting?

When receiving data $_GET (value "0") there is no response.

if ($_GET["open_items"]) 
    {
            echo $_GET["open_items"];
    }

I write file.php?open_items=0 it doesn't return anything.
I write file.php?open_items=1 it returns as it should.
We need it to return 0 when open_items=0 . Help ^^
5ae750279566f206177870.png5ae7502f10ce9561625872.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2018-04-30
@Synacs

if (isset($_GET["open_items"]))

Y
Yan-s, 2018-04-30
@Yan-s

if (!empty($_GET["open_items"])) 
{
        echo $_GET["open_items"];
}

php.net/manual/en/types.comparisons.php
"0" == 0 == false

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question