This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.
RE: RE: PHP: Use associative arrays basically never
You are viewing a single comment's thread from:

RE: PHP: Use associative arrays basically never

Words
72
Reading
1 min
Listen
Play
7y

Hi there:

I really tried to use model classes but it is impractical.

Let's say we want to json_serialize. Ok, it is not a problem. But what if we have a field that it's composed by another model

class Customer {
      var $fieldId=1;
      var $name="";
      var $typeCustomer=new TypeCustomer(); // or we could initialize in the constructor.
}

Serializing it's not fun. However, de-serializing (json) is a big challenge because the system doesn't understand the field $typeCustomer if an object and it de-serialize as stdClass, then every method attached to TypeCustomer fails.

https://dev.to/jorgecc/php-is-bad-for-object-oriented-programming-oop-282a

@jorgecastro: Hi there: I really | Ecency