File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change 112112
113113 $languages[3]="impccc";
114114 echo $languages[3];
115+ $languages = array("HTML/CSS",
116+ "JavaScript", "PHP", "Python", "Ruby");
117+ // Write the code to remove Python here!
118+
119+ unset($languages{3});
120+
121+ foreach($languages as $lang) {
122+ print "<p>$lang</p>";
115123 ?>
116124
125+ // Echoes the first five even numbers
126+ for ($i = 2; $i < 11; $i = $i + 2) {
127+ echo $i;
128+
129+
130+
131+
132+ <?php
133+ $headCount = 0;
134+ $flipCount = 0;
135+ while ($headCount < 3) {
136+ $flip = rand(0,1);
137+ $flipCount ++;
138+ if ($flip){
139+ $headCount ++;
140+ echo "<div class=\"coin\">H</div>";
141+ }
142+ else {
143+ $headCount = 0;
144+ echo "<div class=\"coin\">T</div>";
145+ }
146+ }
147+ echo "<p>It took {$flipCount} flips!</p>";
148+
149+
150+
151+ $c=0;
152+ while($c<4):
153+
154+ echo "<p>Iteration number: {$c}</p>";
155+ $c++;
156+ endwhile;
157+
158+
159+
160+ ?>
161+
162+
163+
164+
165+ <?php
166+ $flipCount = 0;
167+ do {
168+ $flip = rand(0,1);
169+ $flipCount ++;
170+ if ($flip){
171+ echo "<div class=\"coin\">H</div>";
172+ }
173+ else {
174+ echo "<div class=\"coin\">T</div>";
175+ }
176+ } while ($flip);
177+ $verb = "were";
178+ $last = "flips";
179+ if ($flipCount == 1) {
180+ $verb = "was";
181+ $last = "flip";
182+ }
183+ echo "<p>There {$verb} {$flipCount} {$last}!</p>";
184+ ?>
You can’t perform that action at this time.
0 commit comments