Home Products Downloads News Store Support Forums

Stan's Blog

Stan's Blog

Tips and tricks on how to use Maxprog products

Compatible with MS Windows Compatible with MacOS

 Share this page! 

Array of arrays

Topics

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 http://www.maxprog.com]Maxprog[/URL]",
              "URL"  => "http://www.maxprog.com",
              "Text" => "Maxprog"
              );
$urls[] = $url;

$url = array( "Full" => "[URL http://www.apple.com]Apple[/URL]",
              "URL"  => "http://www.apple.com",
              "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="http://www.maxprog.com">Maxprog</a><br>
<a href="http://www.apple.com">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 http://www.maxprog.com]Maxprog[/URL]
URL  => http://www.maxprog.com
Text => Maxprog

Full => [URL http://www.apple.com]Apple[/URL]
URL  => http://www.apple.com
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
at www.maxprog.com





Did you like this post? Share it!


Generic questions
New paragraph
How do I install Maxprog software on my computer?
macOS
MS Windows
New paragraph
How can I change an application language?
macOS
MS Windows
New paragraph
How to register the software I've just purchased?
macOS
MS Windows
New paragraph
How can I recover the serials I have lost of products I purchased here?
macOS
MS Windows
New paragraph
How can I recover my serial from a registered application?
macOS
MS Windows
New paragraph
How can I find out the product name and version my serial unlocks?
macOS
MS Windows
New paragraph
Where can I read your software License Agreement?
macOS
MS Windows
New paragraph
The software doesn't start, runs very slowly or crashes often, how comes?
macOS
MS Windows
New paragraph
Double-clicking on my files no longer opens them with the software, why?
macOS
MS Windows
Stan Busk If you want to make the most of the software that you have acquired at Maxprog, do not miss the Stan's Blog. It is a library of Tutorials and Tips covering specific features and tipical problems you may have when using our tools. This page is updated regularly depending on the topics discussed in our public forums and issues reported thru our HelpDesk. If you are interested on what we are currently working on (or want to participate in beta testings) don't miss the Stan's Logbook.
For years, MAX Programming has provided companies around the globe with sophisticated and innovative solutions. Our commitment to quality is not only evident in our products, but also in our people. It is our mission in Professional Support Services to ensure that our products perform to the fullest of their ability in order to meet the business objectives of our customers. We provide the tools and information required for improved productivity. To accomplish this, we offer an array of services including: Technical Support, Education Services and Consulting Services.

Maxprog is part of an internet site network made of desktoolset.com, emaildesignstudio.com, familycash.com, icash.promo, maxbulkmailer.com, maxprog.com, maxprog.net, maxprog.org, maxprog.us, myrecipients.com, newslettercomposer.com, sharedcontents.com, stanbusk.com, stanbusk.pairserver.com, usertools.com.

 !  WAIT! In order to add a comment below just use your Facebook, Google+, Twitter or Disqus login data.

Home Products Downloads News Store Support Forums