Dysan Posted November 22, 2007 Share Posted November 22, 2007 How do I search an array for a certain value?.... ...and if successful, display "Value Found" else display "Value Not Found"? Link to comment https://forums.phpfreaks.com/topic/78347-search-array-for-value/ Share on other sites More sharing options...
trq Posted November 22, 2007 Share Posted November 22, 2007 <?php $a = array('foo','bar'); if (in_array('bar',$a)) { echo "Value found"; } else { echo "Value not found"; } ?> Link to comment https://forums.phpfreaks.com/topic/78347-search-array-for-value/#findComment-396424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.