tomasd Posted April 8, 2008 Share Posted April 8, 2008 Hi, I was using php's mail function and on the manual it says that message must be string, I have an array consisting of objects I want to mail; stdClass Object ( [check_date] => 2008-04-08 00:17:53 [out_date] => 2008-06-07 [price] => 24.99 ) stdClass Object ( [check_date] => 2008-04-08 00:17:53 [out_date] => 2008-06-07 [price] => 24.99 ) stdClass Object ( [check_date] => 2008-04-08 00:18:02 [out_date] => 2008-06-14 [price] => 24.99 ) stdClass Object ( [check_date] => 2008-04-08 00:18:02 [out_date] => 2008-06-14 [price] => 24.99 ) stdClass Object ( [check_date] => 2008-04-08 00:18:08 [out_date] => 2008-06-21 [price] => 34.99 ) stdClass Object ( [check_date] => 2008-04-08 00:18:08 [out_date] => 2008-06-21 [price] => 24.99 ) stdClass Object ( [check_date] => 2008-04-08 00:18:14 [out_date] => 2008-06-28 [price] => 34.99 ) stdClass Object ( [check_date] => 2008-04-08 00:18:14 [out_date] => 2008-06-28 [price] => 24.99 ) how do I go about doing this? should I have something like while function which would echo the object? Any help or ideas is appreciated Quote Link to comment Share on other sites More sharing options...
Barand Posted April 8, 2008 Share Posted April 8, 2008 try $str = print_r ($objectArray, 1); echo '<pre>', $str, '</pre>'; Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 8, 2008 Share Posted April 8, 2008 Or rather: echo '<pre>'. $str. '</pre>'; Quote Link to comment Share on other sites More sharing options...
Barand Posted April 8, 2008 Share Posted April 8, 2008 If you prefer. either way works Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 8, 2008 Share Posted April 8, 2008 I hate it when this happens. How have I been usng PHP this long and not know that you can also use commas to join strings when echoing?! Apologies - i thought it was a typo. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 8, 2008 Share Posted April 8, 2008 It doesn't concatenate, it's just echo with several arguments. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 8, 2008 Share Posted April 8, 2008 Should probably read the manual first, eh? Ah well, learnt something new today. Quote Link to comment Share on other sites More sharing options...
tomasd Posted April 8, 2008 Author Share Posted April 8, 2008 Thanks, I'll have a go with that and let you guys know! Quote Link to comment 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.