preg_match_all

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Perform a global regular expression match
<?php preg_match_all(    string $pattern,    string $subject,    array &$matches = null,    int $flags = 0,    int $offset = 0): int|false
<?php         $matches      = [];

        $matchesCount = preg_match_all('/[\\s]+order\\s+by\\s/im', $query, $matches, PREG_OFFSET_CAPTURE);

        if ($matchesCount === 0) {

            return true;

        }
<?php             $createSql = $this->getCreateTableSQL($table);



            if (

                preg_match_all(

                    '#

                    (?:CONSTRAINT\s+([^\s]+)\s+)?

                    (?:FOREIGN\s+KEY[^\)]+\)\s*)?

                    REFERENCES\s+[^\s]+\s+(?:\([^\)]+\))?

                    (?:

                        [^,]*?

                        (NOT\s+DEFERRABLE|DEFERRABLE)

                        (?:\s+INITIALLY\s+(DEFERRED|IMMEDIATE))?

                    )?#isx',

                    $createSql,

                    $match

                ) > 0

            ) {

                $names      = array_reverse($match[1]);

                $deferrable = array_reverse($match[2]);