We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,001 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

array problem

Hello,

is my eyes wrong or what but I cannot see simple thing.

//ok
            $this->utils->logging('DEBUG', 'submit dogs card5: ' . serialize($slip_data));

            foreach ($slip_data as $data) {     
                //not ok
                $this->utils->logging('DEBUG', 'submit dogs card7: ' . serialize($data));
            };

the first logging line logs this array:

array (
  36017 => 
  array (
    'subtypes_id' => '1667',
    'special_odds_value' => '0',
    'matches_id' => '805',
    'br_freetext' => 'finisher',
    'coefs_id' => '36017',
    'odd_type' => 'finisher-3',
    'coef' => 1.6,
    'br_odds_id' => '0',
    'home_team' => NULL,
    'away_team' => NULL,
    'br_match_id' => '0',
    'subtype_categories_id' => '4',
    'stake' => '1',
    'stake_eur' => 0.28962001853568,
  ),
  36051 => 
  array (
    'subtypes_id' => '1669',
    'special_odds_value' => '0',
    'matches_id' => '805',
    'br_freetext' => 'even',
    'coefs_id' => '36051',
    'odd_type' => 'even',
    'coef' => 1.5,
    'br_odds_id' => '0',
    'home_team' => NULL,
    'away_team' => NULL,
    'br_match_id' => '0',
    'subtype_categories_id' => '4',
    'stake' => '3',
    'stake_eur' => 0.86886005560704,
  ),
)

And another log line logs to times the same array:

array (
  'subtypes_id' => '1667',
  'special_odds_value' => '0',
  'matches_id' => '805',
  'br_freetext' => 'finisher',
  'coefs_id' => '36017',
  'odd_type' => 'finisher-3',
  'coef' => 1.6,
  'br_odds_id' => '0',
  'home_team' => NULL,
  'away_team' => NULL,
  'br_match_id' => '0',
  'subtype_categories_id' => '4',
  'stake' => '1',
  'stake_eur' => 0.28962001853568,
)

Another time:

array (
  'subtypes_id' => '1667',
  'special_odds_value' => '0',
  'matches_id' => '805',
  'br_freetext' => 'finisher',
  'coefs_id' => '36017',
  'odd_type' => 'finisher-3',
  'coef' => 1.6,
  'br_odds_id' => '0',
  'home_team' => NULL,
  'away_team' => NULL,
  'br_match_id' => '0',
  'subtype_categories_id' => '4',
  'stake' => '1',
  'stake_eur' => 0.28962001853568,
)

I have no clue how can this be. You have an idea?

2
Contributors
2
Replies
36 Minutes
Discussion Span
9 Months Ago
Last Updated
3
Views
Question
Answered
SPeed_FANat1c
Posting Pro in Training
488 posts since Apr 2010
Reputation Points: 13
Solved Threads: 17
Skill Endorsements: 0

It might help if you were a little more descriptive about the problem, other than "not ok"...

blocblue
Practically a Posting Shark
837 posts since Jan 2008
Reputation Points: 272
Solved Threads: 161
Skill Endorsements: 12

found the cause. In previous foreach loop I was using reference and did not unset it for the $data variable.

SPeed_FANat1c
Posting Pro in Training
488 posts since Apr 2010
Reputation Points: 13
Solved Threads: 17
Skill Endorsements: 0
Question Answered as of 9 Months Ago by blocblue

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0641 seconds using 2.68MB