XpertWorlock Posted December 11, 2008 Share Posted December 11, 2008 How would I compare an array to a string for example: $array['Jeff,employee'] = 2/2; /*or*/ $array['Jeff,employee,2/2'] = 1; $string = 2/2; How would I go about comparing if $string is equal to $array? Link to comment https://forums.phpfreaks.com/topic/136588-compare-array-to-string/ Share on other sites More sharing options...
ted_chou12 Posted December 11, 2008 Share Posted December 11, 2008 I dont quite understand the code, but there are multiple strings in an array, u can call up the string u want by specifying the position of the string through sequence by number eg. $array[0] or a unique id of an associative array $array['key'], in ur case i think you are trying to do this: if ($array['Jeff,employee'] == $string) {//do something here} Let me know if i misunderstood u, Ted Link to comment https://forums.phpfreaks.com/topic/136588-compare-array-to-string/#findComment-713150 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.