<?php $client = (object) ['id' => 1]; $databaseValue = '$client->id'; preg_match_all('/^\$(?:[a-z]||[A-Z])\S+/', $databaseValue, $matches); if (!empty($matches)) { $firstVariableOccurance = current(current($matches)); eval("\$value = {$firstVariableOccurance};"); echo "send command {$value}"; } // it return me ^ "status $client->id", i.e. the variable is not executed
You have javascript disabled. You will not be able to edit any code.