Skip to content

Instantly share code, notes, and snippets.

@shahid249
Last active June 26, 2017 18:15
Show Gist options
  • Save shahid249/c18bec6e9ffbef0b3dbeadbc640b5ed2 to your computer and use it in GitHub Desktop.
Save shahid249/c18bec6e9ffbef0b3dbeadbc640b5ed2 to your computer and use it in GitHub Desktop.
This code find specific value or words in arrary - PHP
<?php
// This code find specific value or words in arrary
$array = array('unacceptword', 'unacceptword1', 'unacceptword2');
$array1 = array('noteligible1', 'noteligible2', 'noteligible3');
//here you can post your value by form method | '$_POST[username]'
$obtainvalue = 'noteligible1' ;//'$_POST[username]';
if (in_array($obtainvalue, $array) || in_array($obtainvalue, $array1)){echo 'Not Acceptable';}
else if (in_array($obtainvalue, $array) || in_array($obtainvalue, $array1)){echo 'Not Eligible';}
?>
<!-- Your Form Data -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment