We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code:
<?php // normal behavior January to July .... $ts04 = mktime(00, 12, 00, 04, 1, 2024); $ts05 = mktime(00, 12, 00, 05, 1, 2024); $ts06 = mktime(00, 12, 00, 06, 1, 2024); $ts07 = mktime(00, 12, 00, 07, 1, 2024); // failing behavior in August and September $ts08 = mktime(00, 12, 00, 08, 1, 2024); $ts8 = mktime(00, 12, 00, 8, 1, 2024); // fixed $ts09 = mktime(00, 12, 00, 09, 1, 2024); $ts9 = mktime(00, 12, 00, 9, 1, 2024); // fixed echo 'TNOW = '.date('d-m-Y H:i:s', $ts04)."<br>\n"; echo 'TNOW = '.date('d-m-Y H:i:s', $ts05)."<br>\n"; echo 'TNOW = '.date('d-m-Y H:i:s', $ts06)."<br>\n"; echo 'TNOW = '.date('d-m-Y H:i:s', $ts07)."<br>\n"; echo 'TNOW = '.date('d-m-Y H:i:s', $ts08)."<br>\n"; echo 'TNOW = '.date('d-m-Y H:i:s', $ts8)."<br>\n"; echo 'TNOW = '.date('d-m-Y H:i:s', $ts09)."<br>\n"; echo 'TNOW = '.date('d-m-Y H:i:s', $ts9)."<br>\n"; <?php
Resulted in this output: (for $ts08 and $ts09)
Parse error: Invalid numeric literal in ...
while $ts8 and $ts9 work OK and also all $ts0x until.
But I expected this output instead:
Output for 8.2.0 - 8.2.28, 8.3.0 - 8.3.19, 8.4.1 - 8.4.5 TNOW = 01-04-2024 00:12:00 TNOW = 01-05-2024 00:12:00 TNOW = 01-06-2024 00:12:00 TNOW = 01-07-2024 00:12:00 TNOW = 01-08-2024 00:12:00 TNOW = 01-09-2024 00:12:00
Am I missing something?
PHP 8.2.0 - 8.2.28, 8.3.0 - 8.3.19, 8.4.1 - 8.4.5
No response
The text was updated successfully, but these errors were encountered:
This is because you use a zero-prefix on numbers, that will be interpreted as an octal and is the intended behavior
Sorry, something went wrong.
Can you then explain to me why 01 to 07 works and 08 and 09 don't ? What is the difference ?
01
07
08
09
Because octal is base-8. It only contains digits from 0-7.
Thank you @iluuu1994. Thats is an answer for my question that makes sense to me!
No branches or pull requests
Description
The following code:
Resulted in this output: (for $ts08 and $ts09)
while $ts8 and $ts9 work OK and also all $ts0x until.
But I expected this output instead:
Am I missing something?
PHP Version
PHP 8.2.0 - 8.2.28, 8.3.0 - 8.3.19, 8.4.1 - 8.4.5
Operating System
No response
The text was updated successfully, but these errors were encountered: