Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6926023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:51:54+00:00 2026-05-27T10:51:54+00:00

Particularly, 08 and 09 have caused me some major trouble. Is this a PHP

  • 0

Particularly, 08 and 09 have caused me some major trouble. Is this a PHP bug?

Explanation:
I have a calendar ‘widget’ on a couple of our client’s sites, where we have a HTML hard-coded calendar (I know a PHP function can generate n number of months, but the boss man said ‘no’).

Within each day, there is a PHP function to check for events on that day, passing the current day of the month like so:

<td valign="top">01<?php printShowLink(01, $events) ?></td>

$events is an array of all events on that month, and the function checks if an event is on that day:

function printShowLink($dayOfMonth, $eventsArray) {
    $show = array();
    $printedEvent = array();
    $daysWithEvents = array();

    foreach($eventsArray as $event) {

    if($dayOfMonth == $event['day'] && !in_array($event['id'], $printedEvent)){

        if(in_array($event['day'], $daysWithEvents)) {
            echo '<hr class="calendarLine" />';
        } else {
            echo '<br />';
        }

        $daysWithEvents[] = $event['day']; // string parsed from timestamp

        if($event['linked'] != 1) {
            echo '<div class="center cal_event '.$event['class'].'" id="center"><span title="'.$event['title'].'" style="color:#666666;">'.$event['shorttitle'].'</span></div>';
            $printedEvent[] = $event['id'];
        } else {
            echo '<div class="center cal_event '.$event['class'].'" id="center"><a href="event.php?id='.$event['id'].'" title="'.$event['title'].'">'.$event['shorttitle'].'</a></div>';
            $printedEvent[] = $event['id'];
            }
        }
    }

}

On the 8th and 9th, no events will show up. Passing a string of the day instead of a zero-padded integer causes the same problem.

The solution is as what is should have been in the first place, a non-padded integer. However, my question is, have you seen this odd behavior with 08 and/or 09?

I googled this and couldn’t find anything out there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:51:55+00:00Added an answer on May 27, 2026 at 10:51 am

    Quote it. 0123 without quotes is octal in PHP. It’s in the docs

    $ php -r 'echo 01234, "\n01234\n";'
    668
    01234
    $
    

    So you should change your code to

    <td valign="top">01<?php printShowLink('01', $events) ?></td>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

More particularly - I have a window handle of another running application. This application
I have a project where I am taking some particularly ugly live HTML and
When I asked this previously I should have mentioned that it's particularly a light-weight
I've searched for this a little but I have not gotten a particularly straight
In the end, I have decided that this isn't a problem that I particularly
I have a particularly slow query due to the vast amount of information being
Is it particularly bad to have a very, very large SQL query with lots
I have recently run into a particularly sticky issue regarding committing the result of
I have a general question about the way that database indexing works, particularly in
I am new to ASP.NET MVC, particularly ajax operations. I have a form with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.