{"id":3642,"date":"2021-02-12T09:58:35","date_gmt":"2021-02-12T09:58:35","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=3642"},"modified":"2025-04-10T16:45:37","modified_gmt":"2025-04-10T15:45:37","slug":"for-each","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/memory\/arrays\/for-each","title":{"rendered":"For each"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Foreach result<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  foreach ($Results as $Result)\n  {\n    $MyColumnName = $Result&#91;'MyColumnName'];\n  }<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Getting Key and Value<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  foreach ($MyKeyValueArray as $Key => $Value)\n  {\n    echo \"{$Key} => {$Value} \";\n  }<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Working through a json array<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  foreach ($decoded_json&#91;'MyInternalArrayName'] as $Row =>$NextEntry)\n  {\n    print_r($NextEntry);\n    echo \"***\";\n    echo $NextEntry&#91;'SomeInnerArrayElementName'];\n  }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Foreach result Getting Key and Value Working through a json array<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,298],"tags":[],"class_list":["post-3642","post","type-post","status-publish","format-standard","hentry","category-arrays","category-for"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=3642"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3642\/revisions"}],"predecessor-version":[{"id":4873,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/3642\/revisions\/4873"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=3642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=3642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=3642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}