Take the 256 base compliment

@param string $string The binary string to compliment

@return string The complimented string
337455
protected function compliment($string) {
        $result = '';
        $len    = strlen($string);
        for ($i = 0; $i < $len; $i++) {
            $result .= chr(255 - ord($string[$i]));
        }
        return $result;
    }
1226061
static function placebo( $string ) {
		$len = strlen( $string );
		$out = '';
		for ( $i = 0; $i < $len; $i++ ) {
			$out .= $string[$i];
		}

		return $out;
	}
384618
public function bitsPerCharacter($string)
    {
        if (is_string($string) === false) {
            throw new \InvalidArgumentException('Argument must be a string.');
        }
        $sum = 0;
        $length = strlen($string);
        foreach (array_values(array_count_values(str_split($string))) as $count) {
            $freq = $count / $length;
            $sum += $freq * log($freq, 2);
        }
        return (int) ceil(- $sum);
    }
21362
public static function toUtf8($string)
    {
        $string = explode('@', $string);

        // Not addressing UTF-8 user names
        $new = $string[0];

        if (!empty($string[1])) {
            $domainExploded = explode('.', $string[1]);
            $newdomain      = '';

            foreach ($domainExploded as $domainex) {
                $domainex  = static::decode($domainex);
                $newdomain .= $domainex . '.';
            }

            $newdomain = substr($newdomain, 0, -1);
            $new       = $new . '@' . $newdomain;
        }

        return $new;
    }
1051929
protected static function mbUcFirst($string)
    {
        $firstChar = mb_strtoupper(mb_substr($string, 0, 1, 'utf-8'), 'utf-8');
        return $firstChar . mb_substr($string, 1, mb_strlen($string, 'utf-8'), 'utf-8');
    }
862368
public function asUTF8($string)
    {
        if (CKFinder_Connector_Utils_Misc::isValidUTF8($string)) {
            return $string;
        }

        $ret = "";
        for ($i = 0; $i < strlen($string); $i++) {
            $ret .= CKFinder_Connector_Utils_Misc::isValidUTF8($string[$i]) ? $string[$i] : "?";
        }

        return $ret;
    }
941930
private function _str2hex($string)
    {
        $hex = bin2hex($string);
        $xhex = "";

        for ($i = 0; $i < strlen($hex) - 1; $i += 2) {
            $xhex .= '\x' . $hex[$i] . $hex[$i + 1];
        }

        return $xhex;
    }
562539
public static function stringToUnits($string)
    {
        new Money($string, new Currency('USD')); // TODO optimize?

        return (int)bcmul($string, '100', self::GAAP_PRECISION);
    }
58293
public static function strtoupper($string)
    {
        if(!defined('UTF8_NOMBSTRING') && function_exists('mb_strtolower'))
            return mb_strtoupper($string,'utf-8');

        //global $utf8_lower_to_upper;
        $uni = self::utf8_to_unicode($string);
        $cnt = count($uni);
        for ($i=0; $i < $cnt; $i++){
            if(self::$utf8_lower_to_upper[$uni[$i]]){
                $uni[$i] = self::$utf8_lower_to_upper[$uni[$i]];
            }
        }
        return self::unicode_to_utf8($uni);
    }
182405
public function friendlyUrl($string)
    {
        /**
         * @var Helper $helper
         */
        $helper = $this->helper;

        $string = preg_replace('~[\s\t\n\r]+~', '-', $string);

        $string = $helper->str()->low($string);
        $string = $helper->str()->translit($string);

        return trim(preg_replace('~[^a-z0-9-]+~', '', $string), '-');
    }
536018
public static function strtolower($string): string
    {
        if (in_array(self::$locale->language()->code(), self::DOTLESS_I_LOCALES, true)) {
            $string = strtr($string, self::DOTLESS_I_TOLOWER);
        }

        return mb_strtolower($string);
    }
820933
public static function strlen( $string )
    {
        if ( false === ( $_encoding = static::mbSupported( $string ) ) )
        {
            return strlen( $string );
        }

        return mb_strwidth( $string, $_encoding );
    }
262617
protected static function strLen($string){
    $encoding = function_exists('mb_detect_encoding') ? mb_detect_encoding($string) : false;
    return $encoding ? mb_strlen($string, $encoding) : strlen($string);
  }
999556
public static function uncomment_rfc822($string)
	{
		$string = (string) $string;
		$position = 0;
		$length = strlen($string);
		$depth = 0;

		$output = '';

		while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
		{
			$output .= substr($string, $position, $pos - $position);
			$position = $pos + 1;
			if ($string[$pos - 1] !== '\\')
			{
				$depth++;
				while ($depth && $position < $length)
				{
					$position += strcspn($string, '()', $position);
					if ($string[$position - 1] === '\\')
					{
						$position++;
						continue;
					}
					elseif (isset($string[$position]))
					{
						switch ($string[$position])
						{
							case '(':
								$depth++;
								break;

							case ')':
								$depth--;
								break;
						}
						$position++;
					}
					else
					{
						break;
					}
				}
			}
			else
			{
				$output .= '(';
			}
		}
		$output .= substr($string, $position);

		return $output;
	}
205940
protected function getSubstringBetweenParentheses(string $string): string
    {
        $startingPosition = 0;
        $openParentheses = 0;
        $substring = '';

        $length = strlen($string);
        for ($i = $startingPosition; $i < $length; $i++) {
            if ($string[$i] === ')') {
                $openParentheses--;
            }
            if ($openParentheses > 0) {
                $substring .= $string{$i};
            }
            if ($string[$i] === '(') {
                $openParentheses++;
            }
        }
        if ($openParentheses < 0) {
            throw new InvalidPointcutExpressionException('Pointcut expression is in excess of ' . abs($openParentheses) . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966689);
        }
        if ($openParentheses > 0) {
            throw new InvalidPointcutExpressionException('Pointcut expression lacks of ' . $openParentheses . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966690);
        }
        return $substring;
    }
509102
public static function magic_gpc($string) {
        if (is_array($string)) {
            foreach ($string as $key => $val) {
                $string[$key] = self::magic_gpc($val);
            }
        }
        else {
            $string = trim($string);
        }
        return $string;
    }
919175
public static function stringToKey(string $string): int {
        $key = 0;
        for ($i = 0; $i < \strlen($string); $i++) {
            $char = $string[$i];
            $key += \ord($char);
        }
        return $key;
    }