title: how to reach object property with variable in php
body: <p>I have</p>
  
  <pre><code>foreach(["ge","en","ru"] as $lang)
          {
              Tour_trans::create([
                  "tour_id" =&gt; $tour-&gt;id,
                  "lang_id" =&gt; Langs::where('lang', $lang)-&gt;first()-&gt;id,
                  "title" =&gt; $data["" . $lang . "_title"],
                  "location" =&gt; $data["" . $lang . "_location"],
                  "dept_time" =&gt; $data["" . $lang . "_dept_time"],
                  "depture_time" =&gt; $data["" . $lang . "_dept_time"],
                  "return_time" =&gt; $data["" . $lang . "_return_time"],
                  "body" =&gt; $data["" . $lang . "_body"],
                  "days" =&gt; $data["all_days"]-&gt;$lang
              ]);
          }
  </code></pre>
  
  <p>$data is a json object. everything works fine except last line</p>
  
  <pre><code>"days" =&gt; $data["all_days"]-&gt;$lang
  </code></pre>
  
  <p>i got error Object of class stdClass could not be converted to string.
  in $data["all_days] there are 3 array objects - ge, en, ru. so i want to reach this property in loop</p>