PHP – Convert stdClass object to array

The easiest way is to JSON-encode your object and then decode it back to an array: $array = json_decode(json_encode($object), True); you can traverse the object manually, too: foreach ($object as $value)      $array[] = $value->post_id;

how to load differ image depending on screen width

<script> if (document.documentElement.clientWidth > 940) {    document.write(‘<img class=”<?php echo “ligncenter size-full “.$imgInfo[$randno][id];?>” src=”<?php echo $imgInfo[$randno][src];?>” title=”<?php echo $imgInfo[$randno][title];?>” alt=”<?php echo $imgInfo[$randno][alt];?>” />’); } </script>