Jump to content

newsomjk

New Members
  • Posts

    2
  • Joined

  • Last visited

newsomjk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm sure this is something simple that I'm just overlooking right now, but it's got me very frustrated and I just want a quick fix... I have 2 arrays, $data_old and $totals_old Let's say each looks like this (with the 123456 being different for both): Array ( [2014] => Array ( [123456] => Array ( [EMPS] => 114350 ) ) ) When I merge the two, I get something like this: Array ( [2014] => Array ( [0] => Array ( [123456] => Array ( [EMPS] => 114350 ) ) [1] => Array ( [60] => Array ( [EMPS] => 1470 ) ) ) ) How can I avoid the [0] and [1] and just have those be [123456] and [60], without referencing the 123456 and 60?
  2. So basically, this string is in the database and I can't find what saved it so I'm not sure what method they used to create the string... But I need to break it into an array. I tried originally using $array = unserialize($str), however that printed "not ok." This method prints "ok" however, nothing shows up afterwards. $str = '{"media_id":"235","stream":"0","maxspeed":"3000","maxloads":"0","mloadperInterval":"0","mloadInterval":"0","maxtime":"0","publish_up":"0","publish_down":"0"}'; echo $str; $array = json_decode($str); if ($array !== false) { echo "ok"; } else { echo "not ok"; } echo '<br/><br/>'.print_r($array,true); What am I doing wrong?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.