Jump to content

wyclef

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by wyclef

  1. I think this fixes it? testing now... how does this look?

    function orderByDate($items) {
        $referenceArray = array();
        for ($i = 0; $i < (is_countable($items) ? count($items) : 0); $i++) {
            $referenceArray[] = strtotime($items[$i]['pubDate']);
        }
        array_multisort($referenceArray, SORT_DESC, $items);
        return $items;
    }

     

  2. Hello, I’m getting a fatal error when upgrading from PHP 7.4 to PHP 8:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in...

    on the following count line.

     

    
    
    function orderByDate($items) {
        //$tempDate = strtotime($item);
        $referenceArray = array();
        for ($i = 0; $i < count($items); $i++) {
            $referenceArray[] = strtotime($items[$i]['pubDate']);
        }
        array_multisort($referenceArray, SORT_DESC, $items);
        return $items;
    }
    

     

    Anyone know how to resolve this?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.