Reply to comment

It's based on how PHP

It's based on how PHP converts types.

Converting (int) 0 to a string just wraps the number in quotes, so (int)0 becomes (string)"0"

and "0" is not equal to "x"

Converting (string) "x" to an int, the way php does it is by searching the beginning of the string for numerals, it then takes as many of the numerals it finds (until it hits a non-number) and converts that into an integer. If there are no numbers at the beginning of the string, it defaults to (int)0.

therefore, 0 and 0 are equal.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options