rfc:strict_operators:faq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:strict_operators:faq [2020/07/06 14:56] – switch is not affected jasnyrfc:strict_operators:faq [2020/07/06 14:58] jasny
Line 46: Line 46:
 Both the concatenation operator and arithmetic operators throw a ''%%TypeError%%'' for arrays, resources, and objects. Casting these to a string or int/float doesn't give a proper representation of the value of the operand. Both the concatenation operator and arithmetic operators throw a ''%%TypeError%%'' for arrays, resources, and objects. Casting these to a string or int/float doesn't give a proper representation of the value of the operand.
  
-Using a boolean or null as operand for both concatenation and arithmetic operators also throws a ''%%TypeError%%''. In most cases, the use of a boolean or null indicates an error as many functions return ''%%false%%'' or ''%%null%%'' in case of an error or when no result can be returned. This is different from the function returning an empty string or ''%%0%%''. [[https://php.net/strpos|''%%strpos%%'']] is a well-known example.+Using a boolean or null as operand for both concatenation and arithmetic operators also throws a ''%%TypeError%%''. In most cases, the use of a boolean or null indicates an error as many functions return ''%%false%%'' or ''%%null%%'' in case of an error or when no result can be returned. This is different from the function returning an empty string or ''%%0%%''. [[https://php.net/strpos|strpos]] is a well-known example.
  
 ==== Will comparing a number to a numeric string work with strict_operators? ==== ==== Will comparing a number to a numeric string work with strict_operators? ====
rfc/strict_operators/faq.txt · Last modified: 2020/07/06 15:01 by jasny