#!/usr/bin/env php 0; $i-- ) { if ($data[$i][2] == $GKZ) { $current = $data[$i]; break; } } if(isset($current)) { $header = $data[0]; $nameddata = new stdClass(); foreach( $current as $key => $value ) { $nameddata->{$header[$key]} = $value; } $GKZ_topic = $topic.$GKZ; $mqtt->retain( $GKZ_topic, json_encode($nameddata) ); echo print_r($nameddata, true); } else { echo "Nothing found with GKZ $GKZ\n"; }