Jump to content

Workinclasshero

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Workinclasshero

  1. Hello, Im new to the forums. I am new to web development and figured I needed a good place to find like minded people. I love coding and design, I recently discovered this about 4 years after working many other jobs that just didnt satisfy. I was a welder for several years and while I made good money, I hated my career. So here  I am....

  2. Here are two example of the format of the Arrays, full code and array content in my code below.

     

    ARRAY 1

     

    Array
    (
    [version] => 1.0
    [injuries] => Array
    (
    [timestamp] => 1377702112
    [week] => 1
    [injury] => Array
    (
    [0] => Array
    (
    [status] => Questionable
    [id] => 10009
    [details] => Shoulder

    )

    [1] => Array
    (
    [status] => Questionable
    [id] => 10012
    [details] => Ankle

    )

     

    ARRAY 2

     

    Array
    (
    [version] => 1.0
    [players] => Array
    (
    [timestamp] => 1377676937
    [player] => Array
    (
    [0] => Array
    (
    [position] => TMDL
    [name] => Bills, Buffalo
    [id] => 0251
    [team] => BUF
    )

    [1] => Array
    (
    [position] => TMDL
    [name] => Colts, Indianapolis
    [id] => 10009
    [team] => IND
    )

     

     

    What I need to do is sort through both Arrays and finding matching values for the ID key. I need to then combine the values of both arrays into one array so I can print it out on screen. Here is how far I have gotten on this problem:

     

     

    <?php
     
           function injuries_report() {         
           
           //Get json files
           
             
           //format json data into an array
           
              $obj1 = json_decode($injuryData, true);
             $obj2 = json_decode($playerData, true);
     
           
     
             //return print_r($obj1);   //print obj1 to see output
             
             return print_r($obj2);     //print obj2 to see output
     
           }
     
          ?> 
     
           <!--get injuries report -->

     

          <pre><?php injuries_report(); ?></pre>

     

×
×
  • 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.