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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:45:40+00:00 2026-05-30T04:45:40+00:00

I have a function: function getTrend($results, $region, $monthNo) { $dateMap = getLastNMonths(6); $keys =

  • 0

I have a function:

function getTrend($results, $region, $monthNo)
{
    $dateMap = getLastNMonths(6);
    $keys = array_keys($dateMap);
    $val = $results[$region][$keys[$monthNo]];

    if(isset($val))
    {
        return round($val, 2);
    }
    else {
        return '0.00';
    }
}

..where $val is returning NULL. Now I know there is data in $dateMap and $keys from doing a var_dump() on them…

Here is a couple lines from $results:

array(21) { [“01”]=> array(5) { [“01-SEP-11”]=> string(40)
“596.386666666666666666666666666666666667” [“01-OCT-11”]=> string(40)
“639.347666666666666666666666666666666667” [“01-NOV-11”]=> string(40)
“857.364833333333333333333333333333333333” [“01-DEC-11”]=> string(40)
“663.022833333333333333333333333333333333” [“01-JAN-12”]=> string(41)
“1094.066833333333333333333333333333333333” } [“02”]=> array(5) {
[“01-SEP-11”]=> string(8) “510.1675” [“01-OCT-11”]=> string(8)
“542.4725” [“01-NOV-11”]=> string(8) “809.4245” [“01-DEC-11”]=>
string(40) “314.023833333333333333333333333333333333” [“01-JAN-12”]=>
string(40) “913.979666666666666666666666666666666667” } [“03”]=>
array(5) { [“01-SEP-11”]=> string(40)
“594.528333333333333333333333333333333333” [“01-OCT-11”]=> string(40)
“465.415333333333333333333333333333333333” [“01-NOV-11”]=> string(40)
“508.904666666666666666666666666666666667” [“01-DEC-11”]=> string(8)
“355.6895” [“01-JAN-12”]=> string(7) “706.928” } [“04”]=> array(5) {
[“01-SEP-11”]=> string(40) “112.094833333333333333333333333333333333”
[“01-OCT-11”]=> string(40) “399.436666666666666666666666666666666667”
[“01-NOV-11”]=> string(40) “193.798166666666666666666666666666666667”
[“01-DEC-11”]=> string(40) “246.241666666666666666666666666666666667”
[“01-JAN-12”]=> string(40) “582.542333333333333333333333333333333333”
} [“WOCB”]=> array(5) { [“01-SEP-11”]=> string(40) “216.045166666666666666666666666666666667” [“01-OCT-11”]=> string(40) “139.774333333333333333333333333333333333” [“01-NOV-11”]=> string(7) “254.421” [“01-DEC-11”]=> string(7) “142.355” [“01-JAN-12”]=> string(40) “119.464666666666666666666666666666666667” } [“NONE”]=> array(5) { [“01-SEP-11”]=> string(7) “427.196” [“01-OCT-11”]=> string(40) “430.996333333333333333333333333333333333” [“01-NOV-11”]=> string(40) “259.113666666666666666666666666666666667” [“01-DEC-11”]=> string(40) “188.372166666666666666666666666666666667” [“01-JAN-12”]=> string(40) “332.743333333333333333333333333333333333” } }

Here is a couple lines from $dateMap:

array(6) { [“01-SEP-2011”]=> string(14) “September 2011”
[“01-OCT-2011”]=> string(12) “October 2011” [“01-NOV-2011”]=>
string(13) “November 2011” [“01-DEC-2011”]=> string(13) “December
2011” [“01-JAN-2012”]=> string(12) “January 2012” [“01-FEB-2012”]=>
string(13) “February 2012” } array(6) { [“01-SEP-2011”]=> string(14)
“September 2011” [“01-OCT-2011”]=> string(12) “October 2011”
[“01-NOV-2011”]=> string(13) “November 2011” [“01-DEC-2011”]=>
string(13) “December 2011” [“01-JAN-2012”]=> string(12) “January 2012”
[“01-FEB-2012”]=> string(13) “February 2012” } array(6) {
[“01-SEP-2011”]=> string(14) “September 2011” [“01-OCT-2011”]=>
string(12) “October 2011” [“01-NOV-2011”]=> string(13) “November 2011”
[“01-DEC-2011”]=> string(13) “December 2011” [“01-JAN-2012”]=>
string(12) “January 2012” [“01-FEB-2012”]=> string(13) “February 2012”
}

Here is a couple lines from $keys:

array(6) { [0]=> string(11) “01-SEP-2011” [1]=> string(11)
“01-OCT-2011” [2]=> string(11) “01-NOV-2011” [3]=> string(11)
“01-DEC-2011” [4]=> string(11) “01-JAN-2012” [5]=> string(11)
“01-FEB-2012” } array(6) { [0]=> string(11) “01-SEP-2011” [1]=>
string(11) “01-OCT-2011” [2]=> string(11) “01-NOV-2011” [3]=>
string(11) “01-DEC-2011” [4]=> string(11) “01-JAN-2012” [5]=>
string(11) “01-FEB-2012” } array(6) { [0]=> string(11) “01-SEP-2011”
[1]=> string(11) “01-OCT-2011” [2]=> string(11) “01-NOV-2011” [3]=>
string(11) “01-DEC-2011” [4]=> string(11) “01-JAN-2012” [5]=>
string(11) “01-FEB-2012” } array(6) { [0]=> string(11) “01-SEP-2011”
[1]=> string(11) “01-OCT-2011” [2]=> string(11) “01-NOV-2011” [3]=>
string(11) “01-DEC-2011” [4]=> string(11) “01-JAN-2012” [5]=>
string(11) “01-FEB-2012” } array(6) { [0]=> string(11) “01-SEP-2011”
[1]=> string(11) “01-OCT-2011” [2]=> string(11) “01-NOV-2011” [3]=>
string(11) “01-DEC-2011” [4]=> string(11) “01-JAN-2012” [5]=>
string(11) “01-FEB-2012” }

$monthNo can equal either 0,1,2,3,4,5. For example:

$mo2 = getTrend($results, $region, 1);

My question is, why can I not see anything from $val? What am I missing here? Did I show you enough code? Thanks 🙂

  • 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-30T04:45:41+00:00Added an answer on May 30, 2026 at 4:45 am

    See this part:

    array(21) { ["01"]=> array(5) { ["01-SEP-11"]=> string(40) ...
    

    Look at the key – it’s "01" in quotes. That means it’s a string, so you would have to do

    $results["01"]
    

    to get at that key. If you’re passing in

    $results[1]
    

    It’s not going to show up. When you initially populate $results that key should be cast it to an int

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

Sidebar

Related Questions

i have function public Menu Details(int? id) { return _dataContext.Menu.Include(ChildMenu).FirstOrDefault(m => m.MenuId == id);
i have function which return list as given below. List<User> lstUsers = SearchUsers(searchText); which
i have function <script type=text/javascript> $(function () { $(#search).click(function() { var text = $(#searchText).val();
I have: function SelectSubTopics() { $.ajax({ url: /Administration/Tests/SelectSubTopics, data: { DataSource: $('#DataSource').val(), testID: $('#TestID').val(),
I have function source stored in a string eg.: var source=(function(){return Math.sin(x);}); I want
I have: function getRandomInt(min, max){ return Math.floor(Math.random() * (max - min + 1)) +
Hello: I have function like this one function query($query) { if (in_array($query,$this->queries)) { return
Here's the code I have: function transferq() { if (document.forms[0].elements['return'].checked == true) { document.forms[0].elements['returnhour'].disabled
I have function which return NSArray, but it's generating memory leak, since i can't
I have function f like this function z=f(x,y) if(x<1 & y <1) z=0; else

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.