Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason you can not access values via <code>$obj-&gt;0</code> its because it against PHP variable naming see <a href="http://php.net/manual/en/language.variables.basics.php" rel="nofollow">http://php.net/manual/en/language.variables.basics.php</a> for more information. even if you use <code>ArrayObject</code> you would still have the same issues </p> <p>but there is a patch to this ... you can convert all integer keys to string or write your own conversion function </p> <p>Example </p> <pre><code>$array = array('qualitypoint', 'technologies', 'India' , array("hello","world")); $obj = (object) $array; $obj2 = arrayObject($array); function arrayObject($array) { $object = new stdClass(); foreach($array as $key =&gt; $value) { $key = (string) $key ; $object-&gt;$key = is_array($value) ? arrayObject($value) : $value ; } return $object ; } var_dump($obj2-&gt;{0}); // Sample Output var_dump($obj,$obj2); // Full Output to see the difference $sumObject = $obj2-&gt;{3} ; /// Get Sub Object var_dump($sumObject-&gt;{1}); // Output world </code></pre> <p>Output</p> <pre><code> string 'qualitypoint' (length=12) </code></pre> <p>Full output</p> <pre><code>object(stdClass)[1] string 'qualitypoint' (length=12) string 'technologies' (length=12) string 'India' (length=5) array 0 =&gt; string 'hello' (length=5) 1 =&gt; string 'world' (length=5) object(stdClass)[2] public '0' =&gt; string 'qualitypoint' (length=12) public '1' =&gt; string 'technologies' (length=12) public '2' =&gt; string 'India' (length=5) public '3' =&gt; object(stdClass)[3] public '0' =&gt; string 'hello' (length=5) public '1' =&gt; string 'world' (length=5) </code></pre> <p>Multi Array Outpur </p> <p>Thanks</p> <p>:)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload