# print_r outputs nothing for "false"

- Thread: https://externals.io/message/29100
- Original archive: https://news-web.php.net/php.internals/29100
- Started by Jakob Buchgraber on 2007-04-29T15:31:17+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #29100 — Jakob Buchgraber — 2007-04-29T15:31:17+00:00

URL: https://externals.io/message/29100#29100

Hello!

While debuging I recognized that print_r does not output anything for 
bool(false) (PHP 5.2.1).

e.g.
<?php
print_r (array (true, false, "String"));
?>

Expected result:
Array
(
     [0] => 1
     [1] => 0
     [2] => String
)

Actual result:
Array
(
     [0] => 1
     [1] =>
     [2] => String
)


I was not quite sure whether this is expected behavior, so I haven't 
opened a bug yet.

So, is it expected and why?

Cheers,
Jay

---

## #29101 — Rasmus Lerdorf — 2007-04-29T15:39:10+00:00

URL: https://externals.io/message/29100#29101 · In reply to: #29100

Jakob Buchgraber wrote:
> Hello!
> 
> While debuging I recognized that print_r does not output anything for 
> bool(false) (PHP 5.2.1).
> 
> e.g.
> <?php
> print_r (array (true, false, "String"));
> ?>
> 
> Expected result:
> Array
> (
>     [0] => 1
>     [1] => 0
>     [2] => String
> )
> 
> Actual result:
> Array
> (
>     [0] => 1
>     [1] =>
>     [2] => String
> )
> 
> 
> I was not quite sure whether this is expected behavior, so I haven't 
> opened a bug yet.
> 
> So, is it expected and why?

Because false is not 0.  0 evaluates to false, but so do many other things.

-Rasmus

---

## #29102 — Robert Deaton — 2007-04-29T15:42:16+00:00

URL: https://externals.io/message/29100#29102 · In reply to: #29100

http://www.php.net/manual/en/language.types.string.php#language.types.string.casting

-- 
--Robert Deaton

---

## #29108 — Stefan Walk — 2007-04-30T08:51:10+00:00

URL: https://externals.io/message/29100#29108 · In reply to: #29100

Hi,

for debugging i'd use var_dump, which doesn't output ambiguous things.

Regards,
Stefan
