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 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 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. 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; } 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! Link to comment https://forums.phpfreaks.com/topic/196163-last-error/#findComment-1030143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.