0
$text=$_REQUEST['text'];
$ar=array(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z);
$f = array_search($text, $ar);
echo $f;

If I will type in the field 'text' - "a" it will show me array number - 0; but if I will type 'ab' it will not find anything. Is there way to find multiple values in array at one time?

1
  • Have you tried something to solve it yourself ? Commented Mar 21, 2015 at 16:05

1 Answer 1

1
$text = $_REQUEST['text']; // ab
$ar = range('a','z');
$f = array_intersect($ar, str_split($text, 1));
var_dump($f);

Demo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.