3v4l.org

run code in 500+ PHP versions simultaneously
<?php $client = (object) ['id' => 1]; $databaseValue = '$client->id $test'; preg_match_all('/^\$(?:[a-z]||[A-Z])\S+/', $databaseValue, $matches); if (!empty($matches)) { $firstVariableOccurance = current(current($matches)); eval("\$value = {$firstVariableOccurance};"); echo "Send command {$value}"; }

preferences:
62.66 ms | 1236 KiB | 5 Q