#!/usr/bin/php chips as $chip) { if (empty($chip->legacybranch)) continue; // php 8+ has str_starts_with() if (!(strpos($chip->legacybranch, $BRANCH . ".", 0) === 0)) continue; // devid (Device ID) cannot be empty, other params can be empty if (empty($chip->devid)) { fwrite(STDERR, "Device ID cannot be empty!" . PHP_EOL); exit(EXIT_CODE_PARSEERROR); } $arr = array("devid" => $chip->devid, "subdevid" => $chip->subdevid, "subvendorid" => $chip->subvendorid, "name" => $chip->name, "features" => $chip->features); array_push($chips_arr, $arr); } $chips_arr = array("chips" => $chips_arr); echo json_encode($chips_arr); ?>