Explicitly cast the scores of a Zset associative array as float/double

@param array $arr The ZSet associative array

@return array
486679
private function scoresToFloat(array $arr)
    {
        foreach ($arr as $member => $score) {
            $arr[$member] = (float) $score;
        }

        return $arr;
    }
1055913
private static function _nr3ToDecimal(string $str): float
    {
        /** @var $match string[] */
        if (!preg_match(self::NR3_REGEX, $str, $match)) {
            throw new \UnexpectedValueException(
                "'$str' is not a valid NR3 form real.");
        }
        $m = $match[2];
        // if number started with minus sign
        $inv = $match[1] == "-";
        $e = intval($match[3]);
        // positive exponent
        if ($e > 0) {
            // pad with trailing zeroes
            $num = $m . str_repeat("0", $e);
        } else if ($e < 0) {
            // pad with leading zeroes
            if (strlen($m) < abs($e)) {
                $m = str_repeat("0", abs($e) - strlen($m)) . $m;
            }
            // insert decimal point
            $num = substr($m, 0, $e) . "." . substr($m, $e);
        } else {
            $num = empty($m) ? "0" : $m;
        }
        // if number is negative
        if ($inv) {
            $num = "-$num";
        }
        return floatval($num);
    }
380776
public static function mergeArraysValue($doubleArrays)
    {
        $values = array();
        foreach ($doubleArrays as $array) {
            if (empty($array)) {
                continue;
            }
            foreach ($array as $value) {
                if (in_array($value, $values)) {
                    continue;
                }
                $values[] = $value;
            }
        }

        return $values;
    }
592889
public function getAmount(): float
    {
        $amounts = $this->map(
            function (CalculatedTax $calculatedTax) {
                return $calculatedTax->getTax();
            }
        );

        return array_sum($amounts);
    }
595907
public static function mode($arr)
    {
        $vals = array_count_values($arr);
        asort($vals);
        return end(array_keys($vals));
    }
1032637
public static function isIterator($arr) {
        if (!is_array($arr)) {
            return false;
        }

        foreach (array_keys($arr) as $key) {
            if (!is_numeric($key)) {
                return false;
            }
        }

        return true;
    }
602366
public function writeArray(array $arr) {

            //Check if this is an associative array or not.
            if ( $this->isPureArray( $arr ) ) {
              // Writing the length for the numeric keys in the array
              $arrLen = count($arr);
              $arrId = ($arrLen << 1) | 0x01;
  
              $this->writeInt($arrId);
              $this->writeString('');
  
              foreach($arr as $v) {
                  $this->writeAMFData($v);
              }

            } else {
                $this->writeInt(1);
                foreach($arr as $key=>$value) {
                    $this->writeString($key);
                    $this->writeAMFData($value);
                }
                $this->writeString('');

            }

        }
1269918
private static function array_filter($arr, $values, $inverse = false)
    {
        if (!is_array($values)) {
            $values = explode(',', $values);
        }

        $result = array();
        $keep   = array_flip((array)$values);

        foreach ($arr as $key => $val) {
            if ($inverse != isset($keep[strtolower($val)])) {
                $result[$key] = $val;
            }
        }

        return $result;
    }
121514
public static function remove_empty($arr)
    {
        if (empty($arr)) {
            return null;
        }
        foreach ($arr as $key => $value) {
            if (is_array($value)) {
                $arr[$key] = self::remove_empty($value);
            } else {
                if (empty($value)) {
                    unset($arr[$key]);
                } else {
                    $arr[$key] = $value;
                }
            }
        }
        return $arr;
    }
1333357
private function formatArrayField($arr, $pk = null)
    {
        $ret = [];
        foreach ($arr as $k => $v) {
            if ($pk !== null) {
                $k = $pk . $k;
            }
            if (is_array($v)) {
                $ret = array_merge($ret, $this->formatArrayField($v, $k . ']['));
            } else {
                $ret[$k] = $v;
            }
        }
        return $ret;
    }
566372
public function calculate($values)
    {
        $dataToReplace = array();
        foreach ($this->getVariables() as $mask => $var) {
            $var = $values[$var];
            if ($var instanceof \DateTime) {
                $var = new \Zend_Date($var->getTimestamp());
                $var = $var->get(self::DEFAULT_DATETIME_MASK);
            }
            $dataToReplace[$mask] = $var;
        }
        $condition = str_replace(array_keys($dataToReplace), array_values($dataToReplace), $this->condition);
        $condition = explode($this->operator, $condition);
        if (is_numeric($condition[0])) {
            $condition[0] = floatval($condition[0]);
        } else {
            $condition[0] = trim($condition[0]);
        }
        if (is_numeric($condition[1])) {
            $condition[1] = floatval($condition[1]);
        } else {
            $condition[1] = trim($condition[1]);
        }
        $out = null;
        switch ($this->operator) {
            case self::OPERATOR_EQ:
                $out = $condition[0] == $condition[1];
                break;
            case self::OPERATOR_NEQ:
                $out = $condition[0] != $condition[1];
                break;
            case self::OPERATOR_GRATER:
                $out = $condition[0] > $condition[1];
                break;
            case self::OPERATOR_GRATER_EQ:
                $out = $condition[0] >= $condition[1];
                break;
            case self::OPERATOR_LESS:
                $out = $condition[0] < $condition[1];
                break;
            case self::OPERATOR_LESS_EQ:
                $out = $condition[0] <= $condition[1];
                break;
            default:
                throw new Exception\UnknownPairOperatorException('Operator "' . $this->operator . '" is not supported.');
        }
        return $out;
    }
320901
public static function flatten(array $arr)
    {
        $flattened = [];

        array_walk_recursive($arr, function ($a) use (&$flattened) {
            $flattened[] = $a;
        });

        return $flattened;
    }
1173756
public static function object( $arr ) 
	{
		if( !is_array( $arr ) ) 
		{
			throw new \InvalidArgumentException("CCArr::object - only arrays can be passed.");
		}

		$object = new \stdClass();

		if ( !empty( $arr ) ) 
		{
			foreach ( $arr as $name => $value) 
			{
				if ( is_array( $value ) ) 
				{
					$value = static::object( $value );
				}
				$object->$name = $value;
			}
		}

		return $object;
	}
138823
public function isArrayValueSet($pos, $arr)
    {
        if (is_array($arr) && array_key_exists($pos, $arr) && !empty($arr[$pos])) {
            return true;
        }
    }
604967
public static function alnum($str)
    {
        if(is_array($str)){
            foreach($str as $key=>$val){
                $str[$key] = self::alnum($val);
            }
            return $str;
        }
        return preg_replace('/[^0-9a-z]/i', '', $str);
    }
1090208
public static function assoc($arr, $keys) {
        $out = array();
        foreach ($arr as $cnt => $a) {
            $out[$keys[$cnt]] = $a;
        }

        return $out; 
      }
87721
public static function castValues(Array $originalArray)
  {
    // Convert booleans and integers
    foreach ($originalArray as $key => $value) {

      // Value casting
      switch (true) {

        // Convert booleans
        case $value === 'true':
          $originalArray[$key] = true;
          break 1;
        case $value === 'false':
          $originalArray[$key] = false;
          break 1;

        // Convert integers
        case is_numeric($value):
          $originalArray[$key] = (int) $value;
          break 1;

        // Convert json
        case is_string($value) && null !== ($jsonToArray = json_decode($value, true)):
          $originalArray[$key] = $jsonToArray;
          break 1;
      }
    }

    // Return modfied array
    return $originalArray;
  }