php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63418 intval/strval pass-by-reference
Submitted: 2012-11-02 08:03 UTC Modified: 2012-11-03 04:28 UTC
From: ilyane at list dot ru Assigned:
Status: Wont fix Package: *General Issues
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ilyane at list dot ru
New email:
PHP Version: OS:

 

 [2012-11-02 08:03 UTC] ilyane at list dot ru
Description:
------------
---
From manual page: http://www.php.net/function.intval
---

Why not to add pass-by-reference option?

That would be such a beautiful thing:

intval(&$var);
strval(&$var);

and so on...

Test script:
---------------
$var = "123";

intval(&$var);

var_dump($var); //int(123)

Expected result:
----------------
int(123)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-03 00:37 UTC] mail+php at requinix dot net
Call-time pass-by-reference has been explicitly removed from 5.4 and had a warning 
in 5.3. You should not be using it at all.

If you don't want an assignment then use typecasting: var_dump( (int)$var )
 [2012-11-03 04:28 UTC] laruence@php.net
-Status: Open +Status: Wont fix
 [2012-11-03 04:28 UTC] laruence@php.net
previous comment explained it clearly
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 16:01:30 2024 UTC