Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Filters elements of an array using a callback function
<?php array_filter(array $array, ?callable $callback = null, int $mode = 0): array
<?php return $assetNames;
}
return array_values(array_filter($assetNames, $filter));
}
<?php return $length !== null;
};
return array_filter($this->options['lengths'] ?? [], $filter)
=== array_filter($other->options['lengths'] ?? [], $filter);
}
}
<?php };
return array_filter($this->options['lengths'] ?? [], $filter)
=== array_filter($other->options['lengths'] ?? [], $filter);
}
}
<?php $names = $this->listSchemaNames();
$paths = $this->getSchemaSearchPaths();
$this->existingSchemaPaths = array_filter($paths, static function ($v) use ($names): bool {
return in_array($v, $names, true);
});
}
<?php private function filterColumns(array $columnNames, bool $reverse = false): array
{
return array_filter($this->_columns, static function (string $columnName) use ($columnNames, $reverse): bool {
return in_array($columnName, $columnNames, true) !== $reverse;
}, ARRAY_FILTER_USE_KEY);
}
<?php private function hasElementWithName(array $items, string $name): bool
{
$filteredList = array_filter(
$items,
static function (AbstractAsset $item) use ($name): bool {
return $item->getShortestName($item->getNamespaceName()) === $name;
}
);
return count($filteredList) === 1;
}
<?php $this->schemaManager->dropAndCreateSequence($sequence);
$createdSequence = array_values(
array_filter(
$this->schemaManager->listSequences(),
static function (Sequence $sequence) use ($sequenceName): bool {
return strcasecmp($sequence->getName(), $sequenceName) === 0;
}
)
)[0] ?? null;
self::assertNotNull($createdSequence);
<?php }
$sequences = $this->connection->getSchemaManager()->listSequences();
self::assertCount(1, array_filter($sequences, static function ($sequence): bool {
return strtolower($sequence->getName()) === 'write_table_id_seq';
}));
$nextSequenceVal = $this->connection->fetchOne(
$this->connection->getDatabasePlatform()->getSequenceNextValSQL('write_table_id_seq')