summaryrefslogtreecommitdiffhomepage
path: root/php.html.markdown
diff options
context:
space:
mode:
authorafaqurk <afaq05@gmail.com>2013-08-31 23:44:15 -0400
committerafaqurk <afaq05@gmail.com>2013-08-31 23:44:15 -0400
commitba17d5b9877f324fa633c1670c49e6a867ba5734 (patch)
treee7351c5db03af57b631bc2aef8ddba000837382f /php.html.markdown
parent6071e57cd962462e720f33ec7870810cd67ba528 (diff)
Added unset function to arrays and variables.
Added the unset function to show the varying effects of deleting/removing variables and elements of an array.
Diffstat (limited to 'php.html.markdown')
-rw-r--r--php.html.markdown8
1 files changed, 8 insertions, 0 deletions
diff --git a/php.html.markdown b/php.html.markdown
index 0ff31dd2..19f507ad 100644
--- a/php.html.markdown
+++ b/php.html.markdown
@@ -59,6 +59,9 @@ $float = 1.234;
$float = 1.2e3;
$float = 7E-10;
+// Delete variable
+unset($int1)
+
// Arithmetic
$sum = 1 + 1; // 2
$difference = 2 - 1; // 1
@@ -136,6 +139,11 @@ echo $associative['One']; // prints 1
$array = ['One', 'Two', 'Three'];
echo $array[0]; // => "One"
+// Add an element to the end of an array
+$array[] = 'Four';
+
+// Remove element from array
+unset($array[3]);
/********************************
* Output