Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.


how to create array and how to echo array?

ivan Offline referral

Posts: 717
Joined: Jul 2013
Reputation: 6

Senior Member
I wanna learn how to create array and then how to echo array?
damponting44 Offline referral

Posts: 537
Joined: Oct 2016
Reputation: 0

Senior Member
In PHP, the array() function is used to create an array:
In PHP, there are three types of arrays:

1. Indexed arrays - Arrays with a numeric index.
2. Associative arrays - Arrays with named keys
3. Multidimensional arrays - Arrays containing one or more arrays.
LinensRange786 Offline referral

Posts: 2
Joined: Nov 2017
Reputation: 0

Junior Member
This is such an informative post. You have a lot of categorically great points. I wish I had this post as a means when I in full swing forum posting..
Victor Dub Offline referral

Posts: 892
Joined: Oct 2013
Reputation: 4

Posting Freak
You can use PHP #Explode function to covert list into an #array:
PHP Code:
$array "1
$my_array explode("\n"$array); 

Now you have your values stored in this array: $my_array

To echo array you can use either #printr or #foreach

PHP Code:
foreach($my_array as $vall)

You can also use #implode to echo array and comma separate results like so:

PHP Code:
implode(', '$my_array

Keep in mind that for Multidimensional Array implode won't work you need to use foreach.

User(s) browsing this thread: 1 Guest(s)