Home Products Downloads News Store Support

Stan's Blog

Array of arrays

How to use Maxprog products Maxprog's Blog

Compatible with MS Windows Compatible with MacOS

Array of arrays


In PHP you can use arrays of arrays. This is a very convenient way to store data for later manipulation. This is an example of an array with 2 web records:

$urls = array();

$url = array( "Full" => "[URL]Maxprog[/URL]",
              "URL"  => "",
              "Text" => "Maxprog"
$urls[] = $url;

$url = array( "Full" => "[URL]Apple[/URL]",
              "URL"  => "",
              "Text" => "Apple"
$urls[] = $url;

You can format the output this way:

foreach( $urls as $url ){
    echo "<a href=\"". $url['URL'] . "\">" . $url['Text'] . "</a><br>\n";

The result will be:

<a href="">Maxprog</a><br>
<a href="">Apple</a><br>

You can try this code here.

And in order to get the keys and values:

foreach( $urls as $url ){
    foreach( $url as $key => $value ){
        echo "{$key} => {$value}\n";
    echo "\n";

The result will be:

Full => [URL]Maxprog[/URL]
URL  =>
Text => Maxprog

Full => [URL]Apple[/URL]
URL  =>
Text => Apple

You can try this code here. I have used this approach lately in new Maxprog Knowledge-base system, in order to format parts of the messages depending on their types.

Stan Busk - Software Engineer

Stan Busk Stan Busk
November 16, 2017

Recent questions from our users
  Mail rejected as SPAM UPDATED Screenshot
  How do I enter turboSMTP settings into MaxBulk Mailer YouTube Video
  How I can change the old activation key with the new one? YouTube Video
  Why do I get a Delivery Report message after each delivery? YouTube Video
  Setting DKIM on MaxBulk Mailer YouTube Video
  How do I add an Unsubscribe link to my messages
  How to import a Bank statement into iCash YouTube Video
  Is Maxprog software prepared for macOS 11 Big Sur? Screenshot
  How to transfer email lists between MaxBulk Mailer copies Screenshot
  How can I download files with sequential numbers in their name? YouTube Video
  Images are missing in the message preview Screenshot
  How to send an email with a picture in the body YouTube Video
  How can I send to a big list of emails with MaxBulk Mailer YouTube Video
  Mail-merge sender data using tags YouTube Video
  I set up my bulk email message but authentication fails YouTube Video

  [Valid RSS]  Subscribe to Maxprog's Knowledge Base

▾ Last videos, Online events and Q&A Sessions ▾

▾ Last customer reviews ▾

Did you like this post?

🔐 Site secured by Comodo SSL
🟢 UptimeRobot - Site Loaded properly