razorsese Posted April 30, 2012 Share Posted April 30, 2012 I have the following code which works perfectly "<a href=".$t[$key]->title." />"; but if i change it to "<a href="$t[$key]->title" />"; it's appearing Catchable fatal error: Object of class product could not be converted to string in My question is can someone explain why that error pop-up?! Quote Link to comment https://forums.phpfreaks.com/topic/261848-php-catchable-question/ Share on other sites More sharing options...
pwntastic Posted April 30, 2012 Share Posted April 30, 2012 Hello, i have it understood that since you are using "" within "" you'd have to use \ to escape...for example in the first example you are concatenating your string and $t[$key]->title so it wasn't necessary there. Quote Link to comment https://forums.phpfreaks.com/topic/261848-php-catchable-question/#findComment-1341723 Share on other sites More sharing options...
ManiacDan Posted April 30, 2012 Share Posted April 30, 2012 That's not the right error for the code you've shown. Why did you remove the periods from that string? What are you trying to accomplish? Quote Link to comment https://forums.phpfreaks.com/topic/261848-php-catchable-question/#findComment-1341724 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.