php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80068 Feature request magic methods
Submitted: 2020-09-07 04:38 UTC Modified: 2020-09-07 04:41 UTC
From: peter dot quinn at optushome dot com dot au Assigned:
Status: Duplicate Package: Class/Object related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2020-09-07 04:38 UTC] peter dot quinn at optushome dot com dot au
Description:
------------
A toNumeric(), toArray, toObject would be handy so can cast an object in different ways.

Eg, If I had a object which had the queried result set from a database query within a private member, then could use toString() to display the current row as say a HTML version of it, use toArray to return the current row as an array, and use toObject to return the current row as an object.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-07 04:41 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2020-09-07 04:41 UTC] requinix@php.net
Duplicate of other requests, and the idea of casting objects to other types has been discussed multiple times on the mailing list.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC