dozent_array_to_in_sql( array $array = array() )
Array value to where in sql format
Description
Some time we need to perform mysql query IN() or not IN(), it’s tough to convert an array to in format This function convert array to in sql format
Example usage:
$status = dozent_array_to_in_sql( [ 'publish', 'pending' ] ); // 'publish','pending'
Parameters
- $array
-
(array) (Optional) Input Array
Default value: array()
Return
(string)
Source
File: includes/core-functions.php
4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 | function dozent_array_to_in_sql( $array = [] ) { $in_sql = "" ; $array = ( array ) $array ; $array = array_filter ( $array ); if ( dozent_count( $array ) ) { $in_sql = "'" . implode( "','" , $array ) . "'" ; } return $in_sql ; } |
Changelog
Version | Description |
---|---|
DozentLMS 1.0.0 | Introduced. |