Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Repeat a string
<?php str_repeat(string $string, int $times): string
<?php if (is_string($token)) {
$output .= $token;
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
$output .= str_repeat("\n", substr_count($token[1], "\n"));
} elseif (T_WHITESPACE === $token[0]) {
$whitespace = Preg::replace('{[ \t]+}', ' ', $token[1]);
<?php if ($mode & self::MODE_BY_SUGGESTION) {
if ($mode & self::MODE_BY_PACKAGE) {
$this->io->write(str_repeat('-', 78));
}
foreach ($suggested as $suggestion => $suggesters) {
$this->io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
<?php $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
}
$this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
$this->doWrite($messages, false, $stderr, $verbosity);
<?php $fill = $size - strlen(strip_tags($messages));
if ($fill > 0) {
$this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
$this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
}
<?php $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
$this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
}
if ($newline) {
<?php return $match[0];
}
return str_repeat('\\', $l - 1) . mb_convert_encoding(
pack('H*', $match[2]),
'UTF-8',
'UCS-2BE'
<?php $out = '{' . $this->newline;
$elems = array();
foreach ($data as $key => $val) {
$elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
}
return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
<?php $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
}
return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
}
return JsonFile::encode($data);
<?php $level++;
foreach ($array as $key => $value) {
$lines .= str_repeat(' ', $level);
$lines .= is_int($key) ? $key . ' => ' : '\'' . $key . '\' => ';
if (is_array($value)) {
<?php }
}
$lines .= str_repeat(' ', $level - 1) . ')' . ($level - 1 == 0 ? '' : ",\n");
return $lines;
}
<?php $commonPath = rtrim($commonPath, '/') . '/';
$sourcePathDepth = substr_count(substr($from, \strlen($commonPath)), '/');
$commonPathCode = str_repeat('../', $sourcePathDepth);
return ($commonPathCode . substr($to, \strlen($commonPath))) ?: './';
}
<?php }
$sourcePathDepth = substr_count(substr($from, \strlen($commonPath)), '/') + $directories;
if ($staticCode) {
$commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
} else {
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
}
<?php if ($staticCode) {
$commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
} else {
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
}
$relTarget = substr($to, \strlen($commonPath));
<?php $mask = '';
if ($ones = floor($prefix / 8)) {
$mask = str_repeat(chr(255), (int) $ones);
}
if ($remainder = $prefix % 8) {
<?php private function ipMapTo6($binary, $size)
{
if ($size === 4) {
$prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
$binary = $prefix . $binary;
}