Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86161 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61033 invoked from network); 12 May 2015 00:57:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2015 00:57:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.174 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.214.174 mail-ob0-f174.google.com Received: from [209.85.214.174] ([209.85.214.174:36863] helo=mail-ob0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/31-51861-00051555 for ; Mon, 11 May 2015 20:57:36 -0400 Received: by obbkp3 with SMTP id kp3so113073163obb.3 for ; Mon, 11 May 2015 17:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type; bh=1N4iYkPI1s88JucG0B/35HGX8raOQOQH0EzRIcjMZpw=; b=VtC2Fnw4QELhTCBxoU9pMYrn4NzGKCOSmJu/v2J3ctpUfMTkcVUBsl+Lf6tftlRbD2 lw5l7Qm/81Zve0pUoN+9p7n5kbSYTCz02wYQ8yWg5d5hdjnILq/f1OHkrVOBX5GWXyp4 Kkln6YAv+L68OApjgbzr8XE3Cn9o738b3k0tqOVHISYsJtkFba8OcRkc0pPpsi5edTVI wgvnGC36YkmczV764X7jtzpooP+aK+lQFhTiZldPjCrnm4LScFeU86fs2xQUmRUs3BBZ 84JJsRA5WJM9CqPsAlFC9Za9WySXdHa/JqZAzm0Zxw1WhAOsjgIy6N6ArvBgJ4zc5VvI L9gw== X-Received: by 10.182.101.233 with SMTP id fj9mr10145256obb.72.1431392252622; Mon, 11 May 2015 17:57:32 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.104.196 with HTTP; Mon, 11 May 2015 17:56:52 -0700 (PDT) Date: Tue, 12 May 2015 09:56:52 +0900 X-Google-Sender-Auth: PYQJjTRgyb21jHKu5VsSyHjYJi4 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=e89a8ff2524ac07df80515d7fa6f Subject: is_digits() and digits type From: yohgaki@ohgaki.net (Yasuo Ohgaki) --e89a8ff2524ac07df80515d7fa6f Content-Type: text/plain; charset=UTF-8 Hi all, Firstly, I don't intend this for PHP 7.0 strictly. PHP is made for Web. It means PHP is made for interacting other systems/data. Currently, we only have "int" and "float" strictly bounded to native "unsigned int" and "IEEE 754 double". This causes problems for interacting other systems/data. Conversion to native data type causes problem like RFC 7159 "6 Numbers" points out. https://tools.ietf.org/html/rfc7159 PHP's "int" is more limited because safe value is least common and it's signed 32 bit integer. To resolve this issue, how about to have - is_digits() and digits type for digits only inputs(integer like string) - is_numeric() and numeric type for float like string These check if variable contains only digits or float like string. It's pseudo type, but it prevents developers to specify "int"/"float" type wrongly. These may be extended to allow GMP int/float. Having these make sense for a language made for interaction and make basic type hint use intuitive. IMO. I wouldn't like to write too long mail. My thoughts and concerns are in my blog mostly. http://blog.ohgaki.net/php7-is-going-to-be-strictly-typed-language-will-this-work http://blog.ohgaki.net/dont-use-php7-type-hint-for-external-data Any comments? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --e89a8ff2524ac07df80515d7fa6f--