PHP Classes

PHP Plain Object with Class Variables Set from Array Values package blog

Recommend this page to a friend!

Latest PHP Plain Object with Class Variables Set from Array Values package blog posts

  All package blogs All package blogs   PHP Plain Object with Class Variables Set from Array Values PHP Plain Object with Class Variables Set from Array Values   Blog PHP Plain Object with Class Variables Set from Array Values package blog   Post article Post article  

1. How to Perform PHP Object Initalization from Arrays or Named Parameters

Updated on: 2023-06-29

Posted on:

Hydration is the process of initializing an object variable using values obtained separately.

A hydration class can, for instance, take an associative array, traverse the array values and assign class variables with the values of the array entries that have the same key value as the class variable name.

This package allows hydrating of an object from an associate array with the class variable values.

If you run PHP 8 or later, the package can hydrate an object of named argument values. This way, the object creation and initialization can be done using a single line of readable PHP code.


Blog More ...   Post a comment Post a comment   See comments See comments (0)   Trackbacks (0)


  All package blogs All package blogs   PHP Plain Object with Class Variables Set from Array Values PHP Plain Object with Class Variables Set from Array Values   Blog PHP Plain Object with Class Variables Set from Array Values package blog   Post article Post article