skip to Main Content

PHP lets me define an array key twice

This behavior of PHP has caused me trouble. <?php $myArray = ["thing1" => "a", "thing2" => "b", "thing1" => "c"]; var_dump($myArray); Outputs: array(2) { ["thing1"]=> string(1) "c" ["thing2"]=> string(1) "b" } I would be happier if PHP would throw an…

VIEW QUESTION

Php – Symfony serializer with array of entities

I have 2 DTO objects and I need to convert json to it: class SomeDTO { public function __construct( #[SerializedName('some_property')] private string $someProperty, #[SerializedName('some_other_property')] private int $someOtherProperty, ) { } public function getSomeProperty(): string { return $this->someProperty; } public function…

VIEW QUESTION
Back To Top
Search