Jump to content
Larry Ullman's Book Forums

Recommended Posts

I'm looking for a work-around for the tDebug trait. In my dev environment, I am using php 5.3. In my production environment I am using php 5.4. Can you suggest a way of testing and developing traits in 5.3 that can then easily be converted to an actual trait in 5.4? Thanks, JD.

Share this post


Link to post
Share on other sites

Upgrade you dev environment. Much simpler than doing anything else. If that is not possible for any reason (you depend on 5.3 for other reasons, etc), reasearch how to work with multiple PHP versions on your system.

Share this post


Link to post
Share on other sites

I can't change my dev version to php5.4. I'm stuck with php5.3. Can someone help me change the tDebug trait into a class that I can use to debug classes? I have tried myself. I can't figure it out. Thanks, JohnD

Share this post


Link to post
Share on other sites

You don't actually NEED traits to debug classes. My favorite debugging technique is to put objects or arrays into this:

echo '<pre>' , print_r($object, true) , '</pre>';

It should give you object names and display the object internals. If you want object methods, foreach get_class_methods(). If you want the same functionallity inside your objects methods (for whatever reason) simply create methods that call those functions Larry applies with $this as a parameter.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...