ord

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Convert the first byte of a string to a value between 0 and 255
ord(string $character): int
        $img $this->manager()->make('tests/images/trim.png');

        
$img->interlace();

        
$img->encode('png');

        
$this->assertTrue((ord($img->encoded[28]) != '0'));

        
$img->interlace(false);

        
$img->encode('png');

        
$this->assertFalse((ord($img->encoded[28]) != '0'));
        $this->assertTrue((ord($img->encoded[28]) != '0'));

        
$img->interlace(false);

        
$img->encode('png');

        
$this->assertFalse((ord($img->encoded[28]) != '0'));

    }



    public function 
testGammaImage()
        $img $this->manager()->make('tests/images/trim.png');

        
$img->interlace();

        
$img->encode('png');

        
$this->assertTrue((ord($img->encoded[28]) != '0'));

        
$img->interlace(false);

        
$img->encode('png');

        
$this->assertFalse((ord($img->encoded[28]) != '0'));
        $this->assertTrue((ord($img->encoded[28]) != '0'));

        
$img->interlace(false);

        
$img->encode('png');

        
$this->assertFalse((ord($img->encoded[28]) != '0'));

    }



    public function 
testGammaImage()
        $safe '';



        foreach (
str_split($value) as $letter) {

            if (
ord($letter) > 128) {

                return 
$letter;

            }
            switch (rand(13)) {

                case 
1:

                    
$safe .= '&#'.ord($letter).';';

                    break;

                case 
2:

                    
$safe .= '&#x'.dechex(ord($letter)).';';
                    $safe .= '&#'.ord($letter).';';

                    break;

                case 
2:

                    
$safe .= '&#x'.dechex(ord($letter)).';';

                    break;

                case 
3:

                    
$safe .= $letter;
    private static function convertAlphaVersionToIntVersion($alpha)

    {

        return 
strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord'str_split($alpha)));

    }
        for ($i 0; isset($string[$i]); $i++) {

            
$character $string[$i];

            if (!
ctype_alnum($character) && !in_array($character, array('-''_'), true)) {

                
$character '%' sprintf('%02X'ord($character));

            }

            
$encoded .= $character;

        }
            $s $startCchr;

            
$c $c[$i 0];

            do {

                
$s .= $map[$c[$i]] ?? sprintf('\x%02X'\ord($c[$i]));

            } while (isset(
$c[++$i]));



            return 
$s.$endCchr;
                    $s .= '">';

                }



                
$s .= $map[$c[$i]] ?? sprintf('\x%02X'\ord($c[$i]));

            } while (isset(
$c[++$i]));



            return 
$s.'</span>';