Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active November 20, 2017 11:02
Show Gist options
  • Select an option

  • Save anthonybudd/9c32cc1698cb8b1d6144944a402e3c1c to your computer and use it in GitHub Desktop.

Select an option

Save anthonybudd/9c32cc1698cb8b1d6144944a402e3c1c to your computer and use it in GitHub Desktop.
<?php
$array = ['quick', 'fox'];
$string = 'the quick brown fox jumps over the lazy dog';
if(in_array(1,array_map(function($e)use($string){return(strpos($string, $e)!== FALSE)?1:0;},$array))){
echo "The string contains an element in the array.";
}
@ntzm

ntzm commented Nov 18, 2017

Copy link
Copy Markdown

Since when did PHP have arrow functions lmao

@saiik

saiik commented Nov 20, 2017

Copy link
Copy Markdown

@JoelLarson https://wiki.php.net/rfc/arrow_functions php doesn't have arrow functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment