Skip to content

Instantly share code, notes, and snippets.

@orther
Created March 19, 2011 13:09
Show Gist options
  • Save orther/877469 to your computer and use it in GitHub Desktop.
Save orther/877469 to your computer and use it in GitHub Desktop.
<?php
$find_me = 'fds';
$s1 = 'asd fds gfd hg';
$s2 = 'yj5 werg 3g rth';
$a1 = explode(' ', $s1);
$a2 = explode(' ', $s2);
$token = array_search($find_me, $a1);
if ($token !== FALSE) {
echo 'Ahhhh yeah mother fucker! The token is '.$token.' and the value for that token in string 2 is: '.$a2[$token]."\n";
} else {
echo $find_me.' was not found in string 1.';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment