Annotation of embedaddon/php/ext/standard/tests/strings/print_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test print() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5: 
                      6: /* Prototype  : int print  ( string $arg  )
                      7:  * Description: Output a string
                      8:  * Source code: n/a, print is a language construct not an extension function
                      9:  * Test based on php.net manual example.
                     10: */
                     11: 
                     12: echo "*** Testing print() : basic functionality ***\n";
                     13: 
                     14: echo "\n-- Iteration 1 --\n";
                     15: print("Hello World");
                     16: 
                     17: echo "\n-- Iteration 2 --\n";
                     18: print "print() also works without parentheses.";
                     19: 
                     20: echo "\n-- Iteration 3 --\n";
                     21: print "This spans
                     22: multiple lines. The newlines will be
                     23: output as well";
                     24: 
                     25: echo "\n-- Iteration 4 --\n";
                     26: print "This also spans\nmultiple lines. The newlines will be\noutput as well.";
                     27: 
                     28: echo "\n-- Iteration 5 --\n";
                     29: print "escaping characters is done \"Like this\".";
                     30: 
                     31: // You can use variables inside of a print statement
                     32: $foo = "foobar";
                     33: $bar = "barbaz";
                     34: 
                     35: echo "\n-- Iteration 6 --\n";
                     36: print "foo is $foo"; // foo is foobar
                     37: 
                     38: // You can also use arrays
                     39: $bar = array("value" => "foo");
                     40: 
                     41: echo "\n-- Iteration 7 --\n";
                     42: print "this is {$bar['value']} !"; // this is foo !
                     43: 
                     44: // Using single quotes will print the variable name, not the value
                     45: echo "\n-- Iteration 8 --\n";
                     46: print 'foo is $foo'; // foo is $foo
                     47: 
                     48: // If you are not using any other characters, you can just print variables
                     49: echo "\n-- Iteration 9 --\n";
                     50: print $foo;          // foobar
                     51: 
                     52: echo "\n-- Iteration 10 --\n";
                     53: $variable = "VARIABLE"; 
                     54: print <<<END
                     55: This uses the "here document" syntax to output
                     56: multiple lines with $variable interpolation. Note
                     57: that the here document terminator must appear on a
                     58: line with just a semicolon no extra whitespace!\n
                     59: END;
                     60: ?>
                     61: ===DONE===
                     62: --EXPECT--
                     63: *** Testing print() : basic functionality ***
                     64: 
                     65: -- Iteration 1 --
                     66: Hello World
                     67: -- Iteration 2 --
                     68: print() also works without parentheses.
                     69: -- Iteration 3 --
                     70: This spans
                     71: multiple lines. The newlines will be
                     72: output as well
                     73: -- Iteration 4 --
                     74: This also spans
                     75: multiple lines. The newlines will be
                     76: output as well.
                     77: -- Iteration 5 --
                     78: escaping characters is done "Like this".
                     79: -- Iteration 6 --
                     80: foo is foobar
                     81: -- Iteration 7 --
                     82: this is foo !
                     83: -- Iteration 8 --
                     84: foo is $foo
                     85: -- Iteration 9 --
                     86: foobar
                     87: -- Iteration 10 --
                     88: This uses the "here document" syntax to output
                     89: multiple lines with VARIABLE interpolation. Note
                     90: that the here document terminator must appear on a
                     91: line with just a semicolon no extra whitespace!
                     92: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>