Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Generate a single-byte string from a number
<?php chr(int $codepoint): string
<?php public function testWithoutWordsDoesntProduceError()
{
$nbsp = chr(0xC2).chr(0xA0);
$this->assertSame(' ', (string) $this->stringable(' ')->words());
$this->assertEquals($nbsp, (string) $this->stringable($nbsp)->words());
}
<?php public function testStringWithoutWordsDoesntProduceError()
{
$nbsp = chr(0xC2).chr(0xA0);
$this->assertSame(' ', Str::words(' '));
$this->assertEquals($nbsp, Str::words($nbsp));
}
<?php $string = '';
for ($i = 0; $i < 256; $i++) {
$string .= chr($i);
}
return $string;
<?php $mask = '';
if ($ones = floor($prefix / 8)) {
$mask = str_repeat(chr(255), (int) $ones);
}
if ($remainder = $prefix % 8) {
<?php }
if ($remainder = $prefix % 8) {
$mask .= chr(0xff ^ (0xff >> $remainder));
}
$mask = str_pad($mask, $size, chr(0));
<?php $mask .= chr(0xff ^ (0xff >> $remainder));
}
$mask = str_pad($mask, $size, chr(0));
return $this->ipMapTo6($mask, $size);
}
<?php $net = '';
for ($i = 1; $i < 17; ++$i) {
$net .= chr($ip[$i] & $mask[$i]);
}
return array($net, $netmask);
<?php private function ipMapTo6($binary, $size)
{
if ($size === 4) {
$prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
$binary = $prefix . $binary;
}
<?php $int += 256;
}
return \chr($int);
}
}
<?php if (!extension_loaded('mbstring')) {
$this->markTestSkipped('Test requires the mbstring extension');
}
$backslash = chr(92);
$data = '"' . $backslash . $backslash . $backslash . 'u0119"';
$expected = '"' . $backslash . $backslash . 'ę"';