Automattic\WooCommerce\Utilities
StringUtil::to_sql_list
Convert an array of values to a list suitable for a SQL "IN" statement (so comma separated and delimited by parenthesis). e.g.: [1,2,3] --> (1,2,3)
Метод класса: StringUtil{}
Хуков нет.
Возвращает
Строку. A parenthesized and comma-separated string generated from the values.
Использование
$result = StringUtil::to_sql_list( $values );
- $values(массив) (обязательный)
- The values to convert.
Код StringUtil::to_sql_list() StringUtil::to sql list WC 11.0.1
public static function to_sql_list( array $values ) {
if ( empty( $values ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw new \InvalidArgumentException( self::class_name_without_namespace( __CLASS__ ) . '::' . __FUNCTION__ . ': the values array is empty' );
}
return '(' . implode( ',', $values ) . ')';
}