Examples with type comparison

Asked

Viewed 58 times

1

Hello, I’m wanting to understand a part of PHP documentation and I’m not getting it. I want to understand the part that speaks of comparison with various types.

See more on this link: https://secure.php.net/manual/en/language.operators.comparison.php in part comparison with various types, i do not understand the examples, could give examples with code written in php of how what is written in the documentation is done (based on the documentation)?

I did so in IDEONE of the first example and the result was not as written in the documentation.

Example:

<?php
$palavra = NULL;
$palavra2 = "Pão";

if($r = $palavra == $palavra2) {
var_dump($r);
} else {
var_dump($r);
}

?>

It wasn’t the result that the documentation says, could you give examples of some of those models for me to understand.

I wanted to understand these PHP documentations. I use PHP 7 and I’m starting in the PHP world, but I’ve known PHP for a long time, but now I’m starting programming in it.

  • To say I don’t understand is very complicated, try to be more specific. The way you are each will give a different answer and can be no use because no one knows what your question is. At the moment there is a description of your situation, not a doubt, we need doubts to help.

  • 2

    I want real example of what is discussed in the comparison section with various types, I did not understand how to do that in the code.

  • What was the result and what was the expected result?

  • the result was FALSE, the expected result is what it says in the PHP documentation: "Converts NULL to "", numeric or lexical comparison" and I didn’t understand this and the result wasn’t even what the documentation says

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.