summaryrefslogtreecommitdiff
path: root/Zend/tests/019.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/019.phpt')
-rw-r--r--Zend/tests/019.phpt68
1 files changed, 34 insertions, 34 deletions
diff --git a/Zend/tests/019.phpt b/Zend/tests/019.phpt
index a14a3aead6..7323f5de2f 100644
--- a/Zend/tests/019.phpt
+++ b/Zend/tests/019.phpt
@@ -16,7 +16,7 @@ echo "*** Testing unset(), empty() & isset() with scalar variables ***\n";
// testing scalar variables
$scalar_variables = array(
- 0,
+ 0,
1,
+1
-1,
@@ -52,23 +52,23 @@ foreach ($scalar_variables as $scalar_var) {
echo "-- Iteration $loop_counter --\n"; $loop_counter++;
// checking with isset before unsetting, expected: bool(true)
- var_dump( isset($scalar_var) );
- var_dump( isset($scalar_var, $set_var) );
+ var_dump( isset($scalar_var) );
+ var_dump( isset($scalar_var, $set_var) );
// checking if the var is empty, expected: bool(false) on most
// except "", 0, "0", NULL, FALSE
- var_dump( empty($scalar_var) );
-
+ var_dump( empty($scalar_var) );
+
// destroy the variable using unset
- unset( $scalar_var );
+ unset( $scalar_var );
// dump and see if its destroyed, expcted: NULL
- var_dump( $scalar_var );
+ var_dump( $scalar_var );
// check using isset to see if unset, expected: bool(false)
- var_dump( isset($scalar_var) );
- var_dump( isset($scalar_var, $set_var) );
+ var_dump( isset($scalar_var) );
+ var_dump( isset($scalar_var, $set_var) );
// empty to check if empty, expecting bool(true)
- var_dump( empty($scalar_var) );
+ var_dump( empty($scalar_var) );
// isset() with two args, one arg only unset, expected: bool(false)
var_dump( isset($scalar_var, $set_var) );
@@ -90,16 +90,16 @@ $array_variables = array(
array(1 => "One", 2 => "two"),
array("Name" => "Jack", "Age" => "30"),
array(1,2, "One" => "1", 2 => "two", ""=>"empty", "" => '')
-);
+);
$outer_loop_counter = 1;
foreach ($array_variables as $array_var) {
echo "--- Outerloop Iteration $outer_loop_counter ---\n";
-
+
// check the isset and unset on non existing key
$var = 1; // a var which is defined
// try to unset the element which is non-existent
- unset($array_var['non_existent']);
+ unset($array_var['non_existent']);
// check using isset() & empty() on a non_existent element in the array
var_dump( isset($array_var['non_existent']) );
var_dump( isset($array_var['non_existent'], $var) );
@@ -115,11 +115,11 @@ foreach ($array_variables as $array_var) {
// unset each element in the array and see the working of unset, isset & empty
$inner_loop_counter = 1;
foreach ($keys as $key_value) {
- echo "-- Innerloop Iteration $inner_loop_counter of Outerloop Iteration $outer_loop_counter --\n";
+ echo "-- Innerloop Iteration $inner_loop_counter of Outerloop Iteration $outer_loop_counter --\n";
$inner_loop_counter++;
// unset the element
- unset($array_var[$key_value]);
+ unset($array_var[$key_value]);
// dump the array after element was unset
var_dump($array_var);
// check using isset for the element that was unset
@@ -127,7 +127,7 @@ foreach ($array_variables as $array_var) {
// calling isset with more args
var_dump( isset($array_var[$key_val], $array_var) ); //expected: bool(false)
- // calling empty, expected bool(true)
+ // calling empty, expected bool(true)
var_dump( empty($array_var[$key_val]) );
// dump the array to see that that array did not get modified
@@ -144,7 +144,7 @@ foreach ($array_variables as $array_var) {
// use isset to see that array is not set
var_dump( isset($array_var) ); //expected: bool(false)
var_dump( isset($array_var, $array_var[$key_val]) ); // expected: bool(false)
-
+
// empty() to see if the array is empty
var_dump( empty($array_var) ); // expected: bool(true)
}
@@ -183,7 +183,7 @@ foreach ($resources as $resource) {
unset($temp_var);
// now the isset() with both the args as unset
var_dump( isset($resource, $temp_var) ); // expected: bool(false);
-
+
// dump the resource to see if there any effect on it
var_dump($resource);
}
@@ -200,12 +200,12 @@ class Point
var $x;
var $y;
var $lable;
-
+
function __construct($x, $y) {
$this->x = $x;
$this->y = $y;
}
-
+
function setLable($lable) {
$this->lable = $lable;
}
@@ -281,25 +281,25 @@ echo "\n*** Testing possible variation in operation for isset(), empty() & unset
echo "\n** Testing unset() variation 1: unset on static variable inside a function **\n";
function test_unset1() {
static $static_var;
-
+
// increment the value of the static. this change is in function context
$static_var ++;
-
- echo "value of static_var before unset: $static_var\n";
+
+ echo "value of static_var before unset: $static_var\n";
// check using isset and empty
var_dump( isset($static_var) );
var_dump( empty($static_var) );
-
+
// unset the static var
unset($static_var);
- echo "value of static_var after unset: $static_var\n";
+ echo "value of static_var after unset: $static_var\n";
// check using isset and empty
var_dump( isset($static_var) );
var_dump( empty($static_var) );
// assign a value to static var
$static_var = 20;
- echo "value of static_var after new assignment: $static_var\n";
+ echo "value of static_var after new assignment: $static_var\n";
}
// call the functiont
test_unset1();
@@ -329,7 +329,7 @@ var_dump($value);
test_unset2($value);
var_dump($value);
-
+
echo "\n** Testing unset() variation 3: unset on a global variable inside of a function **\n";
/* unset() variation2: unset on a global variable inside a function
* If a globalized variable is unset() inside of a function, only the
@@ -340,17 +340,17 @@ $global_var = 10;
function test_unset3() {
global $global_var;
-
+
// check the $global_var using isset and empty
- var_dump( isset($global_var) );
- var_dump( empty($global_var) );
-
+ var_dump( isset($global_var) );
+ var_dump( empty($global_var) );
+
// unset the global var
unset($global_var);
-
+
// check the $global_var using isset and empty
- var_dump( isset($global_var) );
- var_dump( empty($global_var) );
+ var_dump( isset($global_var) );
+ var_dump( empty($global_var) );
}
var_dump($global_var);