Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Quote string with slashes
<?php addslashes(string $string): string
<?php protected function modifyComment(Blueprint $blueprint, Fluent $column)
{
if (! is_null($column->comment)) {
return " comment '".addslashes($column->comment)."'";
}
}
<?php return rtrim(sprintf('unique:%s,%s,%s,%s,%s',
$this->table,
$this->column,
$this->ignore ? '"'.addslashes($this->ignore).'"' : 'NULL',
$this->idColumn,
$this->formatWheres()
), ',');
<?php $filename = (string) preg_replace_callback('~^(?P<drive>[a-z]+:\\\)~i', static fn (array $match): string => strtolower($match['drive']), $filename);
}
$filename = str_replace('\\\\', '\\', addslashes((string) realpath($filename)));
$rootPath = TestSuite::getInstance()->rootPath;
$relativePath = str_replace($rootPath.DIRECTORY_SEPARATOR, '', $filename);
<?php public function addSlashes($value)
{
return addslashes($value);
}
<?php $if_true = trim($bits[1]);
$conditional = '<?php if ('.$condition.'): ?>'.addslashes($this->getVariable($if_true, $data)).'<?php endif ?>';
$output = stripslashes($this->parsePhp($conditional));
<?php [$if_true, $if_false] = explode(': ', $bits[1]);
$conditional = '<?php echo('.$condition.') ? "'.addslashes($this->getVariable(trim($if_true), $data)).'" : "'.addslashes($this->getVariable(trim($if_false), $data)).'"; ?>';
$output = stripslashes($this->parsePhp($conditional));
<?php foreach ($modifiers as $modifier) {
if (is_array($modifier)) {
$modifierKey = key($modifier);
$modifierValue = addslashes(current($modifier));
if ($modifierKey === 'default' && ($modifierValue === 'null' || $dataType === 'boolean' || $this->isNumericDefault($dataType, $modifierValue))) {
$column_definition .= sprintf('->%s(%s)', $modifierKey, $modifierValue);
} else {