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

  • Home
  • SEARCH
  • 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 8038491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:15:15+00:00 2026-06-05T03:15:15+00:00

It may just be that I’ve checked out already for the weekend, but having

  • 0

It may just be that I’ve checked out already for the weekend, but having a bit of trouble updating an associative array based on a certain value. For example, here is what I have so far:

$slideshow_vars = array(
        'js_animation'          => $slideshow_options['js_animation'],
        'js_slide_direction'    => $slideshow_options['js_slide_direction'],
        'js_slideshow'          => $slideshow_options['js_slideshow'],
        'js_slideshow_speed'    => $slideshow_options['js_slideshow_speed'],
        'js_animation_duration' => $slideshow_options['js_animation_duration'],
        'js_direction_nav'      => $slideshow_options['js_direction_nav'],
        'js_control_nav'        => $slideshow_options['js_control_nav'],
        'js_keyboard_nav'       => $slideshow_options['js_keyboard_nav'],
        'js_mousewheel'         => $slideshow_options['js_mousewheel'],
        'js_prev_text'          => $slideshow_options['js_prev_text'],
        'js_next_text'          => $slideshow_options['js_next_text'],
        'js_pause_play'         => $slideshow_options['js_pause_play'],
        'js_pause_text'         => $slideshow_options['js_pause_text'],
        'js_play_text'          => $slideshow_options['js_play_text'],
        'js_randomize'          => $slideshow_options['js_randomize'],
        'js_slide_start'        => $slideshow_options['js_slide_start'],
        'js_animation_loop'     => $slideshow_options['js_animation_loop'],
        'js_pause_on_action'    => $slideshow_options['js_pause_on_action'],
        'js_pause_on_hover'     => $slideshow_options['js_pause_on_hover'],
        'js_controls_container' => $slideshow_options['js_controls_container'],
        'js_manual_controls'    => $slideshow_options['js_manual_controls'],
        'js_start_function'     => $slideshow_options['js_start_function'],
        'js_before_function'    => $slideshow_options['js_before_function'],
        'js_after_function'     => $slideshow_options['js_after_function'],
        'js_end_function'       => $slideshow_options['js_end_function']
    );
foreach ($slideshow_vars as $key => $value) {
    if($value == NULL) {
        $value = "false";
    }
}
print_r($slideshow_vars);

In a number of the values in the array, they are outputting NULL — well, I need to change those to a string of false (this data is being localized and then sent to a JS file which expects false). When I perform the above print_r() it hasn’t actually updated anything.

  • 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-05T03:15:17+00:00Added an answer on June 5, 2026 at 3:15 am

    That is because foreach normally passes array fields by value.
    What you need to do is this:

    foreach ($slideshow_vars as $key => &$value) {
        if($value == NULL) {
            $value = "false";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I may just be having trouble with the error-handling documentation, but what I have
I just realized that i may not be following best practices in regards to
I may just be doing something wrong but all of my javascript files as
I'm trying to implement the Send button , but running into what may just
This may be a stupid question but im just starting to learn Rail thats
This may be a really dumb question but I'm just starting to learn the
This may sound like a stupid question but I'm a beginner not just to
May be its a simple question but it's really driving me crazy. I just
I may just need a terminology update, but I have been playing in Magento
This is a relatively simple question that may just not have a solution. Is

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.