Req #78494 [NEW]: Creating simple object with object()
| From: | geoffgedde at gmail dot com | Date: | Wed, 04 Sep 2019 20:31:17 +0000 |
| Subject: | Req #78494 [NEW]: Creating simple object with object() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222561@lists.php.net to get a copy of this message | ||
From: geoffgedde at gmail dot com
Operating system: Any
PHP version: 7.2.22
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Creating simple object with object()
Description:
------------
Many times I prefer the syntax and usage of Objects over Arrays, but
creating objects quickly is awkward and not very readable to the entire
Team. However, it would be simplified if we could use a function called
object() like we do with array(). Sure we could typecast array with
(object) but that could be confusing to other devs if they miss-read or
typecast.
Instead it would be better to do:
$obj = object(
'name' => 'Some Name',
'id' => 123
);
echo $obj->name;
object() is an unused function so why can't it be added in?
--
Edit bug report at https://bugs.php.net/bug.php?id=78494&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78494&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78494&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78494&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78494&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78494&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78494&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78494&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78494&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78494&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78494&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78494&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78494&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78494&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78494&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78494&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78494&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78494&r=mysqlcfg