|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-09-09 10:22 UTC] datibbaw@php.net
-Status: Open
+Status: Not a bug
[2014-09-09 10:22 UTC] datibbaw@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 00:00:01 2025 UTC |
Description: ------------ Pushing a new array element(class), changes existing array elements to its value. Test script: --------------- <?php class PC { } class Part { } $part = new Part(); $pc = new PC(); $part->name = 'CPU'; $pc->arr[] = $part; $part->name = 'GPU'; $pc->arr[] = $part; print_r($pc); ?> Expected result: ---------------- PC Object ( [arr] => Array ( [0] => Part Object ( [name] => CPU ) [1] => Part Object ( [name] => GPU ) ) ) Actual result: -------------- PC Object ( [arr] => Array ( [0] => Part Object ( [name] => GPU ) [1] => Part Object ( [name] => GPU ) ) )