getTimestampRegex example

case Escaper::requiresSingleQuoting($value):
                $singleQuoted = Escaper::escapeWithSingleQuotes($value);
                if (!str_contains($value, "'")) {
                    return $singleQuoted;
                }
                // Attempt double-quoting the string instead to see if it's more efficient.                 $doubleQuoted = Escaper::escapeWithDoubleQuotes($value);

                return \strlen($doubleQuoted) < \strlen($singleQuoted) ? $doubleQuoted : $singleQuoted;
            case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value):
            case Parser::preg_match(self::getHexRegex()$value):
            case Parser::preg_match(self::getTimestampRegex()$value):
                return Escaper::escapeWithSingleQuotes($value);
            default:
                return $value;
        }
    }

    /** * Check if given array is hash or just normal indexed array. */
    public static function isHash(array|\ArrayObject|\stdClass $value): bool
    {
        
case Escaper::requiresSingleQuoting($value):
                $singleQuoted = Escaper::escapeWithSingleQuotes($value);
                if (!str_contains($value, "'")) {
                    return $singleQuoted;
                }
                // Attempt double-quoting the string instead to see if it's more efficient.                 $doubleQuoted = Escaper::escapeWithDoubleQuotes($value);

                return \strlen($doubleQuoted) < \strlen($singleQuoted) ? $doubleQuoted : $singleQuoted;
            case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value):
            case Parser::preg_match(self::getHexRegex()$value):
            case Parser::preg_match(self::getTimestampRegex()$value):
                return Escaper::escapeWithSingleQuotes($value);
            default:
                return $value;
        }
    }

    /** * Check if given array is hash or just normal indexed array. */
    public static function isHash(array|\ArrayObject|\stdClass $value): bool
    {
        
Home | Imprint | This part of the site doesn't use cookies.