Alucni test su php e classi. No array

This commit is contained in:
2014-10-23 12:57:53 +02:00
parent e9628eafd7
commit d2173ec61a
3 changed files with 163 additions and 0 deletions

63
php1.php Normal file
View File

@@ -0,0 +1,63 @@
<?php
// comment
/*
group comment
*/
$mario = '1';
echo "hello $mario \"alfio' gino\n"; // escape character
echo 'hello $mario "alfio\' gino'; // escape character
($mario == 1) ? print 'true': print 'false';
($mario === 1) ? print 'true': print 'false';
echo <<<_XGIOVIO
1 dsasa \ ''
fdf_add_doc_javascript(
, script_name, script_code)
fdsfdsf $mario
_XGIOVIO;
echo <<<_XGIOVIO
1 dsasa \ ''
fdf_add_doc_javascript(
, script_name, script_code)
fdsfdsf \$mario
_XGIOVIO;
echo '<br>';
echo __LINE__;
echo __FILE__;
echo __DIR__;
echo $GLOBALS;
echo TRUE && TRUE;
echo (int) (7/2);
?>

18
php2.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
$a = "mario";
global $a;
test();
function test (){
global $a;
print $a;
}
echo $a;
?>

82
php3.php Normal file
View File

@@ -0,0 +1,82 @@
<?php
include_once "php2.php";
$gino = new b("a","b","c");
$gino->get_constant_a();
echo $gino::A;
a::$alfio = 2;
echo a::$alfio;
echo b::get_alfio();
class a {
const A = "mario";
const B = "mariob";
public $a;
public $b;
static public $alfio;
public function __construct ($i1,$i2){
$a=$i1;
$b=$i2;
}
public function get_constant_a (){
echo self::A;
}
public function test (){
print "ale";
}
}
class b extends a{
const A = "sa";
const B = "sas";
public $c;
static public $alfio;
public static function get_alfio(){
return parent::$alfio;
}
public function __construct ($i1,$i2,$i3){
parent::__construct($i1,$i2);
$c=$i3;
}
public function get_constant_a (){
echo parent::get_constant_a ();
self::test();
}
}
?>