Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58766 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95030 invoked from network); 8 Mar 2012 07:39:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Mar 2012 07:39:13 -0000 Authentication-Results: pb1.pair.com header.from=simonsimcity@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=simonsimcity@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: simonsimcity@googlemail.com X-Host-Fingerprint: 209.85.214.170 mail-tul01m020-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:39936] helo=mail-tul01m020-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/12-15180-022685F4 for ; Thu, 08 Mar 2012 02:39:12 -0500 Received: by obbwd1 with SMTP id wd1so314058obb.29 for ; Wed, 07 Mar 2012 23:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=nwQhDhjNkqDS8ff+WtakugiI4vCcqukBO2z0jrBgm0w=; b=C8fmWLuDO/kwwZ/1c7MCDYCBSAbTqJojTIZesFWCSM03vTg/6/3FyxvZ9TN1psgykw ZI16f/3BFyrwrKx6EA1r5bhJRpqQXpnG4umu4QjFDU495Xtk+ep33b5c70kkmJ8aTKnB 7BI9FDE5C7Wv8fm+AEFiaKXWjQ2c2sdskDmpb/iNSgPR+kEw3vLcyNXU9MoOV8ytAvKF hgUetKEi38DXiMZwCi0GC2sNbJcbOiLX6hV0FkpR4b1QPq9YiyowPMZC7mpcCKf0nWaI e4nxfp8VClQKil1KpyIhqDyEAO8MwyzuNp4kPc6LQHsRFvpqkdJ/5LfIMPSEc0xUt8Db PMLA== MIME-Version: 1.0 Received: by 10.182.12.74 with SMTP id w10mr1940242obb.51.1331192349894; Wed, 07 Mar 2012 23:39:09 -0800 (PST) Received: by 10.60.63.70 with HTTP; Wed, 7 Mar 2012 23:39:09 -0800 (PST) In-Reply-To: References: <52.38.15021.3A1E65F4@pb1.pair.com> <4F570EBB.6030103@sugarcrm.com> <60744d7ea642fe03c7110502a3f4276a@mohiva.com> Date: Thu, 8 Mar 2012 08:39:09 +0100 Message-ID: To: John Crenshaw Cc: Arvids Godjuks , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Scalar Type Hinting From: simonsimcity@googlemail.com (Simon Schick) 2012/3/8 John Crenshaw : > > Conversion the other way is essential. Consider the following URL: > > http://example.com?foo=3D1 > > In your PHP script $_GET['foo'] =3D=3D=3D '1' (a string). > > In fact, nearly every input to PHP is a string. This is why PHP was desig= ned with some seriously robust type juggling on scalars. Any typing proposa= l that wants to actually pass a vote is going to have to allow appropriate = implicit conversions from string to other types. > > John Crenshaw > Priacta, Inc. Hi, John Ok .. the example with the get-parameter is quite good. You'll often have the case that you submit a string "0" or "1" and want to have it as boolean (f.e. if you have a dropdown with two options). Please keep in mind not to mix it up with checkboxes as unchecked checkboxes won't be sent back to your webserver :) Bye Simon