diff --git a/part2.php b/part2.php index 7a23255..ea498a1 100644 --- a/part2.php +++ b/part2.php @@ -34,16 +34,30 @@ they are very flexible just like python lists, and you can change each element, also, you can add elements just as simple as, $friend[4] = "something" <--- if the friend array initially contained 3 elements. + + and we can create a constant valued array of desired length using the following function: + array_fill((int: start index),(int: number of elements),(value to be put)); + + example: + + + the output of above code will be: + Array + ( + [5] => "bosecodes" + [6] => "bosecodes" + + ) */ $friends = array("Kevin", true, 43.43, "Oscar"); $friends[2] = "Dwayne"; $friends[4] = "Angela"; - echo $friends[2]; - echo "
"; - echo $friends[4]; - echo "
"; - echo count($friends); - echo "
"; + echo $friends[2]."
"; + echo $friends[4]."
"; + echo count($friends)."
"; echo "Roses are $color
"; echo "$plural are blue
";