Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Convert the first byte of a string to a value between 0 and 255
<?php ord(string $character): int
<?php $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'));
<?php $this->assertTrue((ord($img->encoded[28]) != '0'));
$img->interlace(false);
$img->encode('png');
$this->assertFalse((ord($img->encoded[28]) != '0'));
}
public function testGammaImage()
<?php $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'));
<?php $this->assertTrue((ord($img->encoded[28]) != '0'));
$img->interlace(false);
$img->encode('png');
$this->assertFalse((ord($img->encoded[28]) != '0'));
}
public function testGammaImage()
<?php $safe = '';
foreach (str_split($value) as $letter) {
if (ord($letter) > 128) {
return $letter;
}
<?php switch (rand(1, 3)) {
case 1:
$safe .= '&#'.ord($letter).';';
break;
case 2:
$safe .= '&#x'.dechex(ord($letter)).';';
<?php $safe .= '&#'.ord($letter).';';
break;
case 2:
$safe .= '&#x'.dechex(ord($letter)).';';
break;
case 3:
$safe .= $letter;
<?php private static function convertAlphaVersionToIntVersion($alpha)
{
return strlen($alpha) * (-ord('a') + 1) + array_sum(array_map('ord', str_split($alpha)));
}
<?php 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;
}
<?php $s = $startCchr;
$c = $c[$i = 0];
do {
$s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.$endCchr;
<?php $s .= '">';
}
$s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));
return $s.'</span>';