Re: Raise E_NOTICE for null castings
| From: | lists@rhsoft.net | Date: | Fri, 27 Oct 2017 11:22:28 +0000 |
| Subject: | Re: Raise E_NOTICE for null castings | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100961@lists.php.net to get a copy of this message | ||
Am 27.10.2017 um 12:54 schrieb Niklas Keller:
thanks - that's indeed the better solution and since i use MYSQLI_OPT_INT_AND_FLOAT_NATIVE in the database layer the complete type-casting can be removed too!pleae don't break code like this which is a useful case for access directly a array field returned from a function and so makes this to a one-liner without check the resultpublic function GetMaxSort(): int { return (int)mysqli_fetch_row($this->cl_api->db->query("select SQL_NO_CACHE max(hsort) from {$this->cl_api->sql_prefix}main", 1))[0];}Just use return (int) mysqli_fetch_row($this->cl_api->db->query("select SQL_NO_CACHE max(hsort) from {$this->cl_api->sql_prefix}main", 1))[0] ?? 0;