Soldato
Hi,
I have any array below, and I'd like to sort the participants array based on the FastestLapTime in the attributes array within the participants array in PHP but I can't seem to work it out. Does anyone have any ideas?
Thanks,
Pete
I have any array below, and I'd like to sort the participants array based on the FastestLapTime in the attributes array within the participants array in PHP but I can't seem to work it out. Does anyone have any ideas?
Code:
{
"result" : "ok",
"response" : {
"state" : "Running",
"name" : "TGC_NCC_Prac",
"lobbyid" : 109775242071612398,
"joinable" : true,
"max_member_count" : 32,
"now" : 1432393004,
"attributes" : {
"GridSize" : 32,
"MaxPlayers" : 32,
"Practice1Length" : 0,
"Practice2Length" : 0,
"QualifyLength" : 0,
"WarmupLength" : 90,
"Race1Length" : 1,
"Race2Length" : 0,
"Flags" : 263192,
"Privacy" : 0,
"DamageType" : 3,
"TireWearType" : 6,
"FuelUsageType" : 0,
"PenaltiesType" : 0,
"AllowedViews" : 0,
"TrackId" : -907901266,
"VehicleGroupId" : -1300724070,
"VehicleModelId" : -554602958,
"DateYear" : 2015,
"DateMonth" : 4,
"DateDay" : 7,
"DateHour" : 12,
"DateMinute" : 0,
"DateProgression" : 1,
"ForecastProgression" : 1,
"WeatherSlots" : 1,
"WeatherSlot1" : 888299130,
"WeatherSlot2" : 888299130,
"WeatherSlot3" : 888299130,
"WeatherSlot4" : 888299130,
"GameMode" : -1958878043,
"SessionState" : "Race",
"SessionStage" : "Warmup",
"SessionPhase" : "Green",
"SessionTimeElapsed" : 3495,
"SessionTimeDuration" : 5400,
"NumParticipantsValid" : 2,
"NumParticipantsDisqualified" : 0,
"NumParticipantsRetired" : 0,
"NumParticipantsDNF" : 0,
"NumParticipantsFinished" : 0
},
"members" : [
{
"index" : 0,
"refid" : 52224,
"steamid" : 76561197967372717,
"state" : "Connected",
"name" : "Blackvault",
"jointime" : 1432389462,
"host" : true,
"attributes" : {
"VehicleId" : -1770401008,
"LiveryId" : 60,
"LoadState" : "ADMIN_STARTED_RACE",
"RaceStatFlags" : 1073751268,
"Ping" : 17
}
},
{
"index" : 1,
"refid" : 59841,
"steamid" : 76561198089530706,
"state" : "Connected",
"name" : "ChrisP79",
"jointime" : 1432389477,
"host" : false,
"attributes" : {
"VehicleId" : -1770401008,
"LiveryId" : 67,
"LoadState" : "CLIENT_READY",
"RaceStatFlags" : 1073784037,
"Ping" : 52
}
},
{
"index" : 2,
"refid" : 23618,
"steamid" : 76561198195616982,
"state" : "Connected",
"name" : "sgmack20",
"jointime" : 1432392382,
"host" : false,
"attributes" : {
"VehicleId" : -1770401008,
"LiveryId" : 67,
"LoadState" : "CLIENT_READY",
"RaceStatFlags" : 1073751141,
"Ping" : 40
}
},
{
"index" : 3,
"refid" : 34179,
"steamid" : 76561197960405504,
"state" : "Connected",
"name" : "Martin G Webb",
"jointime" : 1432392560,
"host" : false,
"attributes" : {
"VehicleId" : -1770401008,
"LiveryId" : 51,
"LoadState" : "CLIENT_READY",
"RaceStatFlags" : 1073751045,
"Ping" : 42
}
},
{
"index" : 4,
"refid" : 63748,
"steamid" : 76561198030665694,
"state" : "Connected",
"name" : "hobbnob",
"jointime" : 1432392950,
"host" : false,
"attributes" : {
"VehicleId" : -1770401008,
"LiveryId" : 62,
"LoadState" : "UNKNOWN",
"RaceStatFlags" : 0,
"Ping" : 47
}
}
],
"participants" : [
{
"attributes" : {
"RefId" : 52224,
"Name" : "Blackvault",
"IsPlayer" : 1,
"GridPosition" : 1,
"VehicleId" : -1770401008,
"LiveryId" : 60,
"RacePosition" : 4,
"CurrentLap" : 0,
"CurrentSector" : 0,
"Sector1Time" : 0,
"Sector2Time" : 0,
"Sector3Time" : 0,
"LastLapTime" : 0,
"FastestLapTime" : 0,
"State" : "InGarage",
"HeadlightsOn" : 0,
"WipersOn" : 0,
"Speed" : 0,
"Gear" : 0,
"RPM" : 0,
"PositionX" : 108430,
"PositionY" : 28130,
"PositionZ" : -15770,
"Orientation" : 179
},
"id" : 0
},
{
"attributes" : {
"RefId" : 59841,
"Name" : "ChrisP79",
"IsPlayer" : 1,
"GridPosition" : 2,
"VehicleId" : -1770401008,
"LiveryId" : 67,
"RacePosition" : 2,
"CurrentLap" : 9,
"CurrentSector" : 1,
"Sector1Time" : 33392,
"Sector2Time" : 102101,
"Sector3Time" : 36393,
"LastLapTime" : 135222,
"FastestLapTime" : 134932,
"State" : "Racing",
"HeadlightsOn" : 0,
"WipersOn" : 0,
"Speed" : 158,
"Gear" : 5,
"RPM" : 6540,
"PositionX" : 230830,
"PositionY" : 25560,
"PositionZ" : -201910,
"Orientation" : 77
},
"id" : 1
},
{
"attributes" : {
"RefId" : 23618,
"Name" : "sgmack20",
"IsPlayer" : 1,
"GridPosition" : 4,
"VehicleId" : -1770401008,
"LiveryId" : 67,
"RacePosition" : 3,
"CurrentLap" : 0,
"CurrentSector" : 0,
"Sector1Time" : 0,
"Sector2Time" : 0,
"Sector3Time" : 0,
"LastLapTime" : 0,
"FastestLapTime" : 0,
"State" : "InGarage",
"HeadlightsOn" : 0,
"WipersOn" : 0,
"Speed" : 0,
"Gear" : 0,
"RPM" : 0,
"PositionX" : 87570,
"PositionY" : 28200,
"PositionZ" : -15700,
"Orientation" : 181
},
"id" : 3
},
{
"attributes" : {
"RefId" : 34179,
"Name" : "",
"IsPlayer" : 1,
"GridPosition" : 3,
"VehicleId" : -1770401008,
"LiveryId" : 51,
"RacePosition" : 1,
"CurrentLap" : 3,
"CurrentSector" : 3,
"Sector1Time" : 8399,
"Sector2Time" : 64830,
"Sector3Time" : 36325,
"LastLapTime" : 134965,
"FastestLapTime" : 134843,
"State" : "Racing",
"HeadlightsOn" : 0,
"WipersOn" : 0,
"Speed" : 130,
"Gear" : 4,
"RPM" : 6758,
"PositionX" : 343590,
"PositionY" : 26300,
"PositionZ" : 14740,
"Orientation" : 294
},
"id" : 4
}
]
}
}
Thanks,
Pete