Skip to content

Instantly share code, notes, and snippets.

@mdrakibhossainhawlader
Forked from sepehr/in_arrayi.php
Created July 9, 2018 00:49
Show Gist options
  • Save mdrakibhossainhawlader/2fd825d2ea1aef6c8ddecbe7015c48b6 to your computer and use it in GitHub Desktop.
Save mdrakibhossainhawlader/2fd825d2ea1aef6c8ddecbe7015c48b6 to your computer and use it in GitHub Desktop.

Revisions

  1. @sepehr sepehr created this gist Aug 27, 2013.
    14 changes: 14 additions & 0 deletions in_arrayi.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?php

    /**
    * Case-insensitive in_array() wrapper.
    *
    * @param mixed $needle Value to seek.
    * @param array $haystack Array to seek in.
    *
    * @return bool
    */
    function in_arrayi($needle, $haystack)
    {
    return in_array(strtolower($needle), array_map('strtolower', $haystack));
    }