{"id":10835611,"date":"2018-10-31T19:19:48","date_gmt":"2018-10-31T19:19:48","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/quick-php-warning-fix\/"},"modified":"2018-10-31T19:20:20","modified_gmt":"2018-10-31T19:20:20","slug":"quick-php-warning-fix","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/quick-php-warning-fix\/","title":{"rendered":"Quick PHP warning fix"},"content":{"rendered":"<pre><code>\nif ( is_array( $photos ) ) {\n\t$first_photo = array_pop( array_reverse( $photos ) );\n}\n<\/code><\/pre>\n<p>causes a PHP Strict warning about passing by reference. I believe this is equivalent and supported in all PHP releases:<\/p>\n<pre><code>\nif ( is_array( $photos ) &amp;&amp; count( $photos ) &gt; 0 ) {\n\t$first_photo = array_values( $photos )[0];\n}\n<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-10835611","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10835611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10835611\/revisions"}],"predecessor-version":[{"id":10835615,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10835611\/revisions\/10835615"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10835611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}