note 126391 added to language.types.float

From: Date: Sun, 05 Sep 2021 17:59:51 +0000
Subject: note 126391 added to language.types.float
Groups: php.notes 
Request: Send a blank email to php-notes+get-216868@lists.php.net to get a copy of this message
Beware of NaN and strings in PHP. In other languages (and specifically in Javascript) math operations with non-numerical strings will result in NaN, while in PHP the string is silently converted to 0. So any test like: is_nan('hello, string'); // false gives the impression that the string is a valid number. ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 177.47.141.132) ---- Manual Page -- https://php.net/manual/en/language.types.float.php Edit -- https://main.php.net/note/edit/126391 Del: integrated -- https://main.php.net/note/delete/126391/integrated Del: useless -- https://main.php.net/note/delete/126391/useless Del: bad code -- https://main.php.net/note/delete/126391/bad+code Del: spam -- https://main.php.net/note/delete/126391/spam Del: non-english -- https://main.php.net/note/delete/126391/non-english Del: in docs -- https://main.php.net/note/delete/126391/in+docs Del: other reasons-- https://main.php.net/note/delete/126391 Reject -- https://main.php.net/note/reject/126391 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216868) next »