<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[funzione php]]></title><description><![CDATA[<p dir="auto">Buongiorno a tutti,</p>
<p dir="auto">una domanda forse banale:</p>
<p dir="auto">ho una funzione:</p>
<pre><code class="language-php">public function slideshow_homepage() {
$array_articolo = array();
$query_articolo = mysql_query("SELECT * FROM wp_posts WHERE post_status = 'publish' AND post_type = 'post'");
while ($row = mysql_fetch_assoc($query_articolo)):
$array_articolo[] = array(
"post_title" =&gt; $row['post_title'],
"post_date" =&gt; $row['post_date'],
"post_content" =&gt; $row['post_content'],
"post_author" =&gt; $row['post_author']
);
endwhile;

$array_autore = array();
$query_autore = mysql_query("SELECT * FROM wp_usermeta WHERE meta_key = 'first_name' OR meta_key = 'last_name'");
while ($row = mysql_fetch_assoc($query_autore)):
$array_autore[] = array(
"meta_value" =&gt; $row['meta_value'],
"user_id" =&gt; $row['user_id']
);
endwhile;
}
</code></pre>
<p dir="auto">vorrei poter accedere agli array: $array_articolo e $array_autore</p>
<p dir="auto">fuori dalla funzione, per poi ciclarli con dei foreach;</p>
<p dir="auto">è possibile?</p>
<p dir="auto">ringrazio in anticipo<br />
buona giornata</p>
]]></description><link>https://dev.connect.gt/topic/222802/funzione-php</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 02:53:22 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/222802.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 Apr 2016 12:10:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to funzione php on Wed, 27 Apr 2016 16:59:22 GMT]]></title><description><![CDATA[<p dir="auto">si funziona grazie mille! <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--smile" style="height:1.4em;width:auto;vertical-align:middle" title=":D" alt="😄" /></p>
]]></description><link>https://dev.connect.gt/post/1221576</link><guid isPermaLink="true">https://dev.connect.gt/post/1221576</guid><dc:creator><![CDATA[enricocarli]]></dc:creator><pubDate>Wed, 27 Apr 2016 16:59:22 GMT</pubDate></item><item><title><![CDATA[Reply to funzione php on Tue, 26 Apr 2016 17:43:20 GMT]]></title><description><![CDATA[<p dir="auto">Intendi poter stampare a video l'array fuori dalla funzione? Io avevo fatto una cosa del genere:</p>
<pre><code class="language-php">public function slideshow_homepage() {
$array_articolo = array();
$query_articolo = mysql_query("SELECT * FROM wp_posts WHERE post_status = 'publish' AND post_type = 'post'");
while ($row = mysql_fetch_assoc($query_articolo)):
$array_articolo[] = array("post_title" =&gt; $row['post_title'],"post_date" =&gt; $row['post_date'],"post_content" =&gt; $row['post_content'],"post_author" =&gt; $row['post_author']);
endwhile;
$array_autore = array();$query_autore = mysql_query("SELECT * FROM wp_usermeta WHERE meta_key = 'first_name' OR meta_key = 'last_name'");
while ($row = mysql_fetch_assoc($query_autore)):
$array_autore[] = array("meta_value" =&gt; $row['meta_value'],"user_id" =&gt; $row['user_id']);
endwhile;


//Imposta due variabili globali contenti l'array

$GLOBALS['articolo'] = $array_articolo
$GLOBALS['autore'] = $array_articolo

}  
//crei la funzione che consente di ciclare e stampare il contenuto dell'array

function stampa($array)
{
 foreach($array as $arr)
{
echo $arr;
}
}

// stampi il contenuto dell'array

function slideshow_homepage();
stampa($articolo);
stampa($autore);
</code></pre>
<p dir="auto">Fammi sapere se funziona</p>
]]></description><link>https://dev.connect.gt/post/1221577</link><guid isPermaLink="true">https://dev.connect.gt/post/1221577</guid><dc:creator><![CDATA[mr.php]]></dc:creator><pubDate>Tue, 26 Apr 2016 17:43:20 GMT</pubDate></item></channel></rss>