Skip to content

Instantly share code, notes, and snippets.

@davist11
Last active August 29, 2015 13:57

Revisions

  1. davist11 revised this gist Mar 13, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pi.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    <?php

    public function in_array()
    {
    $haystack = $this->EE->TMPL->fetch_param('haystack', NULL);
  2. davist11 created this gist Mar 13, 2014.
    13 changes: 13 additions & 0 deletions pi.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    public function in_array()
    {
    $haystack = $this->EE->TMPL->fetch_param('haystack', NULL);
    $needle = $this->EE->TMPL->fetch_param('needle', NULL);

    if ($haystack === NULL || $needle === NULL) {
    return;
    }

    $haystack = explode('|', $haystack);

    return in_array($needle, $haystack);
    }