strptime

FunctionMisc changes in PHP 8.4

Parse a time/date generated with strftime.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
Deprecated
PHP 8.2-8.3
PHP 8.4
Changed
PHP 8.5
PHP 8.6

strptime Function synopsis

#[\Deprecated]
strptime(string $timestamp, string $format): array|false

Parameters

$timestamp

Typestring

The string to parse (e.g. returned from strftime).

$format

Typestring

The format used in $timestamp (e.g. the same as used in strftime). Note that some of the format options available to strftime may not have any effect within strptime; the exact subset that are supported will vary based on the operating system and C library in use.

Return value

Typearray|false

Returns an array or false on failure.

Changes to the strptime Function

PHP 8.4

PHP 8.1

  • Function deprecated

PHP 8.0

  • Return type added: array|false
  • Parameter type added for parameter #1 ($timestamp): string
  • Parameter type added for parameter #2 ($format): string
- strptime($timestamp, $format)
+ strptime(string $timestamp, string $format): array|false

strptime Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes Deprecated
PHP 8.5Supported (Latest) Yes Deprecated
PHP 8.4Supported Yes Deprecated
PHP 8.3Security-Fixes Only Yes Deprecated
PHP 8.2Security-Fixes Only Yes Deprecated
PHP 8.1Unsupported Yes Deprecated
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes