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 8958485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:13:26+00:00 2026-06-15T15:13:26+00:00

Answer: So my issue turned out to be with the $eventValue and not the

  • 0

Answer:

So my issue turned out to be with the $eventValue and not the key. I was assuming the key was wrapped in brackets when it was added to the $days array but that was not the case. var_export showed me what really gets added to the array.

To solve the problem, I removed the enclosing quotes from the $eventValue as well as the trailing , comma.

Below is the original question:

Apologies as I do not know a whole lot of PHP, but I am trying to achieve something that I hope someone here can help with.

I have a loop that is finding specific days of a month to highlight on a calendar. In order for the calendar to highlight a specific day and wrap it in a class as well as a link tag, I need the array to be in this format:

$days = array(

    2 => array('/weblog/archive/2004/Jan/02', 'linked-day'),
    3 => array('/weblog/archive/2004/Jan/03', 'linked-day'),
    8 => array('/weblog/archive/2004/Jan/08', 'linked-day'),
    22 => array('/weblog/archive/2004/Jan/22', 'linked-day'),

);

Within my loop, I have these two variables:

$eventDay = substr("$str", -2, 2);
$eventValue = "array('http://example.com', 'linked-day'),";

and at the end of my loop I have this:

$days[$eventDay] = $eventValue;

The problem is, when I print_r ($days), my $eventDay key is wrapped in [] square brackets and so the day cannot be found by the calendar. I need to find a way to prevent it from being wrapped in brackets.

Perhaps I am approaching this all wrong. If someone has some suggestions I would really appreciate it.

I am using Keith Devens’ PHP Calendar script to do this:

http://keithdevens.com/software/php_calendar

Thanks!

Full code:

http://pastie.org/5503664

  • 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-06-15T15:13:27+00:00Added an answer on June 15, 2026 at 3:13 pm

    Replace

    $eventValue = "array('http://example.com', 'linked-day'),";
    

    with

    $eventValue = array('http://example.com', 'linked-day');
    

    in line 44 of the pastie

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT : Accepted answer points out what my issue was. I added another answer
I've searched here a bit but could not find an answer to my issue.
I have an issue which I could not find answer for across the web.
I have some urgent issue which I could not find answer for across the
I have an issue with PDO that I'd really like to get an answer
This is a general question that comes to answer an issue that interests me
I went through similar questions here but did not find an answer to the
I have yet another issue which the answer is eluding me. I wish to
This is a follow up issue relating to the answer for SQL placeholder in
There are nice SO question and answers about this issue, but these options didn't

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.