Loading Arrays from Files (use for loop)

<?php
$DOCUMENT_ROOT = $_SERVER[‘DOCUMENT_ROOT’];
$orders=file(“DOCUMENT_ROOT/../orders/orders.txt”);
$number_of_orders = count($orders);
if ($number_of_orders == 0){
echo ”

No orders pending.Please try again later.

“;

}else{

for ($i=0;$i<$number_of_orders;$i++){

echo $orders[$i].”
“;
}

}
?>

3 dimensional arrays with for loop

<?php
    $categories = array(array( array( ‘CAR_TIR’, ‘Tires’, 100 ),
                        array( ‘CAR_OIL’, ‘Oil’, 10 ),
                        array( ‘CAR_SPK’, ‘Spark Plugs’, 4 ) ),
                 array( array( ‘VAN_TIR’, ‘Tires’, 120 ),
                        array( ‘VAN_OIL’, ‘Oil’, 12 ),
                        array( ‘VAN_SPK’, ‘Spark Plugs’, 5 ) ),
                array( array( ‘TRK_TIR’, ‘Tires’, 150 ),
                        array( ‘TRK_OIL’, ‘Oil’, 15 ),
                        array( ‘TRK_SPK’, ‘Spark Plugs’, 6 ) )
                        );
    for ($layer =0;$layer <3; $layer++){
        echo “layer $layer<br/>”;
        for ($row =0; $row<3; $row++){
            for ($column =0; $column<3; $column++){
            echo ‘|’.$categories[$layer][$row][$column];
        
        }
            echo ‘|<br/>’;
        }
    
    }
    
    
    
    
?>

a simple sample for loop and while loop in php

$prices = array(‘Tires’=>100, ‘Oil’=>10, ‘Spark Plugs’=>4);

The foreach loop has a slightly different structure when using associative arrays.You
can use it exactly as you did in the previous example, or you can incorporate the keys as
well:
foreach ($prices as $key => $value) {
echo $key.” – “.$value.”<br />”;
}

The following code lists the contents of the $prices array using the each() construct:
while ($element = each($prices)) {
echo $element[‘key’];
echo ” – “;
echo $element[‘value’];
echo “<br />”;
}

There is a more elegant and more common way of doing the same thing.The construct
list() can be used to split an array into a number of values.You can separate two
of the values that the each() function gives you like this:
while (list($product, $price) = each($prices)) {
echo “$product – $price<br />”;
}

The output of this script fragment is shown in Figure 3.2.

Tires – 100
Oil – 10
Spark Plugs – 4

Visual Studio 2010 freedown + Crack

first:Microsoft Visual Studio 2010 down(come from www.microsoftstore.com

      (Premium) 【link】
       http://download.microsoft.com/download/F/F/8/FF8C8AF1-D520-4027-A844-8EC7BC0FB27C/X16-42546VS2010PremTrial1.iso

      (Professional)
       http://download.microsoft.com/download/4/0/E/40EFE5F6-C7A5-48F7-8402-F3497FABF888/X16-42555VS2010ProTrial1.iso

      (Ultimate)
       http://download.microsoft.com/download/2/4/7/24733615-AA11-42E9-8883-E28CDCA88ED5/X16-42552VS2010UltimTrial1.iso

then,Help->Register Product->:YCFHQ-9DWCY-DKV88-T2TMH-G7BHP then enter

Image

Image

or you can

       use thisProduct Key:YCFHQ9DWCYDKV88T2TMHG7BHP,to cover setup.sdb [Product Key]

if you already install fee trial, just change Product Key:YCFHQ9DWCYDKV88T2TMHG7BHP,then fine.

xml and xsl and css connected example

first, you need have a wine.xml,this is for store your wines database: see below:

<?xml version=”1.0″ encoding=”UTF-8″?>
<?xml-stylesheet type=”text/css” href=”wine.css”?>
<!DOCTYPE wines [
<!ELEMENT wines (wine+)>
<!ELEMENT wine (name,country,location,history,color,year,served)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT country (#PCDATA)>
<!ELEMENT location (#PCDATA)>
<!ELEMENT history (#PCDATA)>
<!ELEMENT color (#PCDATA|span)*>
<!ELEMENT span (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT served (#PCDATA)>
]>
<?xml-stylesheet type=”text/xsl” href=”wine.xsl”?>
<wines>
<wine>
<name>Rough Red</name>
<country>Italy</country>
<location>Turin</location>
<history>Some oenologists believe that Rough Red goes back to Roman times.</history>
<color>dark ruby-red wine – traditionally, it is called,<span>”black as rabbit’s blood”</span></color>
<year>2010</year>
<served>Rough Red should be served at 15 – 16 _C(59 – 60.8_F)
</served>
</wine>

<wine>
<name>Cabernet Merlot</name>
<country>South Australia</country>
<location>Australia</location>
<history>A soft, round and gloriously fleshy palate delivers flavours of ripe plum, red berries along with subtle liquorice and chocolate, finishing in a smooth and elegant fashion.
This is such an easy-drinking, soft and approachable wine. There is wonderful flavour and richness but it’s not at all confronting…a bit like a red wine with training wheels…and a true little treasure!</history>
<color>dark ruby-red wine – traditionally, it is called,<span>”black as rabbit’s blood”</span></color>
<year>2009</year>
<served>Rough Red should be served at 15 – 16 _C(59 – 60.8_F)
</served>
</wine>

</wines>

Then,save as win.xml you use xsl to style your wines’ data, see below(xml can let your xml data display in html ) Continue reading xml and xsl and css connected example

What is XML? What is XSL? What is the relationship between XML AND XSL?

What is XML?

  • XML stands for EXtensible Markup Language
  • XML is a markup language much like HTML
  • XML was designed to carry data, not to display data
  • XML tags are not predefined. You must define your own tags
  • XML is designed to be self-descriptive
  • XML is a W3C Recommendation

What is XSL?

XSLT is the recommended style sheet language of XML.

XSLT (eXtensible Stylesheet Language Transformations) is far more sophisticated than CSS.

XSLT can be used to transform XML into HTML, before it is displayed by a browser.

What is the relationship between XML AND XSL?

XSL gives your XML some style

banner slide show

<!doctype html>
    <head>
        <title>Title</title>

        <style type="text/css" media="screen">
            .slides_container {
                width:570px;
                height:270px;
            }
            .slides_container div {
                width:570px;
                height:270px;
                display:block;
            }
        </style>

        <script src="http://code.jquery.com/jquery-latest.min.js"></script>
        <script src="slides.js"></script>

        <script>
            $(function(){
                $("#slides").slides();
            });
        </script>
    </head>
    <body>
        <div id="slides">
            <div class="slides_container">
                <div>
                    <img src="http://placehold.it/570x270">
                </div>
                <div>
                    <img src="http://placehold.it/570x270">
                </div>
                <div>
                    <img src="http://placehold.it/570x270">
                </div>
                <div>
                    <img src="http://placehold.it/570x270">
                </div>
            </div>
        </div>
    </body>

chinese_Zodiac_for_loop in php

<?php
$startYear = 1912;
$endYear = 2013;
$numYears = ($startYear – $endYear) + 1;
$animalsUpper = array(“RAT”, “OX”, “TIGER”, “RABBIT”, “DRAGON”, “SNAKE”, “HORSE”, “GOAT”, “MONKEY”, “ROOSTER”, “DOG”, “PIG”);
$animalsLower = array(“rat”, “ox”, “tiger”, “rabbit”, “dragon”, “snake”, “horse”, “goat”, “monkey”, “rooster”, “dog”, “pig”);

echo “<table border=\”1\” align=\”center\”><tr>”;

for ($i = 0; $i < 12; ++$i) {
echo “<th align=\”center\”>” . $animalsUpper[$i] . “</th>”;
}

echo “</tr><tr>”;

for ($i = 0; $i < 12; ++$i) {
echo “<td align=\”center\”><img src=\”images/” . $animalsLower[$i] . “.jpg\”></td>”;
}

for ($i = $startYear; $i <= $endYear; ++$i) {
if ((($i – $startYear) % 12) == 0) {
echo “</tr><tr>”;
}
echo “<td align=\”center\”>” . $i . “</td>”;
}

echo “</tr></table>”;
?>

Full stack developer