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     'key' => env('APP_KEY'),



    'previous_keys' => [

        ...array_filter(

            explode(',', env('APP_PREVIOUS_KEYS', ''))

        ),

    ],
<?php     'key' => env('APP_KEY'),



    'previous_keys' => [

        ...array_filter(

            explode(',', env('APP_PREVIOUS_KEYS', ''))

        ),

    ],
<?php             'prefix_indexes' => true,

            'strict' => true,

            'engine' => null,

            'options' => extension_loaded('pdo_mysql') ? array_filter([

                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),

            ]) : [],

        ],



        'mariadb' => [
<?php             'prefix_indexes' => true,

            'strict' => true,

            'engine' => null,

            'options' => extension_loaded('pdo_mysql') ? array_filter([

                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),

            ]) : [],

        ],



        'pgsql' => [
<?php     public function retrieveByCredentials(array $credentials)

    {

        $credentials = array_filter(

            $credentials,

            fn ($key) => ! str_contains($key, 'password'),

            ARRAY_FILTER_USE_KEY

        );



        if (empty($credentials)) {

            return;
<?php     public function retrieveByCredentials(array $credentials)

    {

        $credentials = array_filter(

            $credentials,

            fn ($key) => ! str_contains($key, 'password'),

            ARRAY_FILTER_USE_KEY

        );



        if (empty($credentials)) {

            return;
<?php         $signature = $this->generateAblySignature(

            $request->channel_name,

            $request->socket_id,

            $userData = array_filter([

                'user_id' => (string) $broadcastIdentifier,

                'user_info' => $result,

            ])

        );



        return [
<?php         $result = $this->dynamoDbClient->query([

            'TableName' => $this->table,

            'KeyConditionExpression' => $condition,

            'ExpressionAttributeValues' => array_filter([

                ':application' => ['S' => $this->applicationName],

                ':id' => array_filter(['S' => $before]),

            ]),

            'Limit' => $limit,

            'ScanIndexForward' => false,

        ]);
<?php             'KeyConditionExpression' => $condition,

            'ExpressionAttributeValues' => array_filter([

                ':application' => ['S' => $this->applicationName],

                ':id' => array_filter(['S' => $before]),

            ]),

            'Limit' => $limit,

            'ScanIndexForward' => false,
<?php             $update = "SET total_jobs = total_jobs + :val, pending_jobs = pending_jobs + :val, #{$this->ttlAttribute} = :ttl";

        }



        $this->dynamoDbClient->updateItem(array_filter([

            'TableName' => $this->table,

            'Key' => [

                'application' => ['S' => $this->applicationName],

                'id' => ['S' => $batchId],

            ],

            'UpdateExpression' => $update,

            'ExpressionAttributeValues' => array_filter([

                ':val' => ['N' => "$amount"],

                ':ttl' => array_filter(['N' => $this->getExpiryTime()]),

            ]),

            'ExpressionAttributeNames' => $this->ttlExpressionAttributeName(),

            'ReturnValues' => 'ALL_NEW',

        ]));

    }
<?php                 'id' => ['S' => $batchId],

            ],

            'UpdateExpression' => $update,

            'ExpressionAttributeValues' => array_filter([

                ':val' => ['N' => "$amount"],

                ':ttl' => array_filter(['N' => $this->getExpiryTime()]),

            ]),

            'ExpressionAttributeNames' => $this->ttlExpressionAttributeName(),

            'ReturnValues' => 'ALL_NEW',

        ]));
<?php             'UpdateExpression' => $update,

            'ExpressionAttributeValues' => array_filter([

                ':val' => ['N' => "$amount"],

                ':ttl' => array_filter(['N' => $this->getExpiryTime()]),

            ]),

            'ExpressionAttributeNames' => $this->ttlExpressionAttributeName(),

            'ReturnValues' => 'ALL_NEW',
<?php             $update = "SET pending_jobs = pending_jobs - :inc, #{$this->ttlAttribute} = :ttl";

        }



        $batch = $this->dynamoDbClient->updateItem(array_filter([

            'TableName' => $this->table,

            'Key' => [

                'application' => ['S' => $this->applicationName],

                'id' => ['S' => $batchId],

            ],

            'UpdateExpression' => $update,

            'ExpressionAttributeValues' => array_filter([

                ':inc' => ['N' => '1'],

                ':ttl' => array_filter(['N' => $this->getExpiryTime()]),

            ]),

            'ExpressionAttributeNames' => $this->ttlExpressionAttributeName(),

            'ReturnValues' => 'ALL_NEW',

        ]));



        $values = $this->marshaler->unmarshalItem($batch['Attributes']);
<?php                 'id' => ['S' => $batchId],

            ],

            'UpdateExpression' => $update,

            'ExpressionAttributeValues' => array_filter([

                ':inc' => ['N' => '1'],

                ':ttl' => array_filter(['N' => $this->getExpiryTime()]),

            ]),

            'ExpressionAttributeNames' => $this->ttlExpressionAttributeName(),

            'ReturnValues' => 'ALL_NEW',

        ]));
<?php             'UpdateExpression' => $update,

            'ExpressionAttributeValues' => array_filter([

                ':inc' => ['N' => '1'],

                ':ttl' => array_filter(['N' => $this->getExpiryTime()]),

            ]),

            'ExpressionAttributeNames' => $this->ttlExpressionAttributeName(),

            'ReturnValues' => 'ALL_NEW',