Level 122
its preferred.
Objects are a lot more flexible and powerful than arrays.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I always displayed data on applications like so
Controller :
$user = User::find($id)->firstOrFail();
View :
<span>$user->name</span>
<span>$user->lname</span>
I was just wondering, is this wrong or unpractical? To use an object instead of array or json or whatever.
its preferred.
Objects are a lot more flexible and powerful than arrays.
Please or to participate in this conversation.