php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #2284 type conversion in list()
Submitted: 1999-09-12 15:24 UTC Modified: 2000-08-17 10:38 UTC
From: tsf at post dot cz Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.12 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tsf at post dot cz
New email:
PHP Version: OS:

 

 [1999-09-12 15:24 UTC] tsf at post dot cz
list is a great construct that can save you many lines
of code.  however, i often need to do user conversions
and then the magic of list() is gone... could you
possibly add a syntax extension allowing commands like

list((int)$foo, (int)$bar) = $array_of_foo_and_bar;

or is it a nonsense? :)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-09-21 13:22 UTC] tsf at post dot cz
and thinking about it more now... how about empty variables
(like in prolog?)

list($a, _, $c) = $myarray;

the underscore is probably not o.k. here (it would collide 
with a constant named _ , i guess) but it should do as an
example. I used it  because that is what is used in
Prolog. So those of you familiar with that language should 
know what i mean.
 [1999-09-21 13:54 UTC] rasmus at cvs dot php dot net
list($a,,$c) = $myarray();
 [2000-08-17 10:38 UTC] hholzgra@php.net
works in 3.0.16 and 4
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 17 16:00:02 2026 UTC