MainelyDesign.com Blog

In PHP, how do you get __toString() Magic Method Result without calling echo?

Posted on 10/13/2017 at 01:49 pm by Kevin Wentworth
Viewed 8,576 times | 0 comments

I knew this answer at one point, then forgot it.  So, here it is for memory's sake...

How can you get __toString() Magic Method Output WITHOUT using echo statement?

  1. $echoed = strval($object->property);

Cheers,
- Kevin Wentworth

Bookmark and Share

Tags for In PHP, how do you get __toString() Magic Method Result without calling echo?

Cakephp | Cake3 | Cakephp 13 | Php | Web Programming

Comments for this Posting

No comments. Be the first to post a reply.

Sorry, comments are closed for this posting.

Please Email Kevin if you have any questions. Thanks!

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design