Objektum stdClass (csoportosítás feltétellel)
2021-03-13T21:07:22+01:00
2021-03-23T03:12:15+01:00
2022-08-12T01:40:30+02:00
richi4100
Sziasztok,

elakadtam és a segítségetekre volna most szükségem.
Adott egy objektum. Ennek az objektumnak csak azon bizonyos elemeit szeretném tömbbé alakítani, amelyekre teljesül az, hogy a 
$items['value']['0']['My_Table_Subfolder']
nem tartalmazza azt a kifejezést, hogy "Rejected" vagy "Raw"

Az egyes objektumokat be tudom járni, de azok száma szintén dinamikusan változhat, így valószínű egy loop-ot be kell építenem majd. AMire jutottam eddig:
Az egyes objektum kívánt elemeit le tudom kérni:

$files_obj_std = json_decode($files); print_r($files_obj_std); //stdClass Object foreach ($files_obj_std as $items) { //print_r($items); $Link = print_r($items['value']['0']['My_Table_Azurelink'],true); $Subfolder = print_r($items['value']['0']['My_Table_Subfolder'],true); }
Amit viszont én szeretnék, az az, hogy összegyújteni az összes ['My_Table_Azurelink'] -et egy tömbe, ahol a
['My_Table_Subfolder']
nem tartalmazza semmilyen körülmények között azt, hogy "Rejected" vagy "Raw"

Az objektum így néz ki:

stdClass Object ( [@odata.context] => xxxxx [@odata.count] => 10 [value] => Array ( [0] => stdClass Object ( [ID] => 18113 [My_Table_Azurelink] => 59c1ee9e64.ZIP [My_Table_fileDeleted] => [My_Table_Filesize] => 595395 [My_Table_Subfolder] => 07_Subfolder Rejected [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2020-12-18T09:44:04.4 ) [1] => stdClass Object ( [ID] => 18114 [My_Table_Azurelink] => Mo_V1.17.docx [My_Table_fileDeleted] => [My_Table_Filesize] => 4373143 [My_Table_Subfolder] => 07_Subfolder Rejected [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2020-12-18T09:44:22.6420971Z ) [2] => stdClass Object ( [ID] => 18115 [My_Table_Azurelink] => MoV1.17.docx [My_Table_fileDeleted] => [My_Table_Filesize] => 3659705 [My_Table_Subfolder] => 07_Subfolder Rejected [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2020-12-18T09:44:23.8188283Z ) [3] => stdClass Object ( [ID] => 18116 [My_Table_Azurelink] => bf0/4.0_DE-DE.msi.zip [My_Table_fileDeleted] => [My_Table_Filesize] => 58155090 [My_Table_Subfolder] => 07_Subfolder Rejected [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2020-12-18T09:47:58.7692475Z ) [4] => stdClass Object ( [ID] => 18117 [My_Table_Azurelink] => 449d7451/4.0_EN-US.msi.zip [My_Table_fileDeleted] => [My_Table_Filesize] => 57667140 [My_Table_Subfolder] => 07_Subfolder Rejected [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2020-12-18T09:49:28.1736972Z ) [5] => stdClass Object ( [ID] => 18304 [My_Table_Azurelink] => f9688/402_V1.17.docx [My_Table_fileDeleted] => [My_Table_Filesize] => 3660505 [My_Table_Subfolder] => 06_Subfolder Released [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2021-01-12T11:20:48.1238683Z ) [6] => stdClass Object ( [ID] => 18305 [My_Table_Azurelink] => 13f95cd1-3bd8/1.17.docx [My_Table_fileDeleted] => [My_Table_Filesize] => 4367330 [My_Table_Subfolder] => 06_Subfolder Released [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2021-01-12T11:20:48.4729466Z ) [7] => stdClass Object ( [ID] => 18540 [My_Table_Azurelink] => 2594c120/ox Setup 8.0.2_EN-ENG.msi [My_Table_fileDeleted] => [My_Table_Filesize] => 57986048 [My_Table_Subfolder] => 05_Subfolder Raw [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2021-01-29T13:47:18.9188229Z ) [8] => stdClass Object ( [ID] => 18541 [My_Table_Azurelink] => acda/ox Setup 8.0.2_DE-DE.msi [My_Table_fileDeleted] => [My_Table_Filesize] => 58480640 [My_Table_Subfolder] => 05_Subfolder Raw [My_Table_Uploadspeed] => [My_Table_Uploadtime] => [My_Table_Element_Id] => 3168 [My_Table_Element_List] => Table [Created] => 2021-01-29T13:49:05.4776752Z ) ) )
Mutasd a teljes hozzászólást!
minek bajlódsz stdClass-okkal?

json_decode($jsonString, true) esetén rögtön tömböt kapsz... onnantól pedig foreach.
Mutasd a teljes hozzászólást!

abcd