thisisedie Posted March 22, 2010 Share Posted March 22, 2010 Hiya. Let me see if I can explain this. I have form that gives an error message saying "you need to answer questions 1, 2, 3, etc" if the field isn't filled in. I'd like to know if there's a way I can make it "you need to answer questions 1, 2 and 3", the and coming before the last error of course. Thanks for your time Quote Link to comment https://forums.phpfreaks.com/topic/196163-last-error/ Share on other sites More sharing options...
inversesoft123 Posted March 22, 2010 Share Posted March 22, 2010 share code Quote Link to comment https://forums.phpfreaks.com/topic/196163-last-error/#findComment-1030132 Share on other sites More sharing options...
thisisedie Posted March 22, 2010 Author Share Posted March 22, 2010 I'm not exactly sure which part to post, it's a long script. Quote Link to comment https://forums.phpfreaks.com/topic/196163-last-error/#findComment-1030135 Share on other sites More sharing options...
ignace Posted March 22, 2010 Share Posted March 22, 2010 function str_and(array $array) { $last_value = array_pop($array); return implode(', ', $array) . ' and ' . $last_value; } Quote Link to comment https://forums.phpfreaks.com/topic/196163-last-error/#findComment-1030139 Share on other sites More sharing options...
thisisedie Posted March 22, 2010 Author Share Posted March 22, 2010 Thank you SO much Ignace! Quote Link to comment https://forums.phpfreaks.com/topic/196163-last-error/#findComment-1030143 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.