Skip to content

Instantly share code, notes, and snippets.

@loraxx753
Created October 17, 2012 20:49
Show Gist options
  • Save loraxx753/3908087 to your computer and use it in GitHub Desktop.
Save loraxx753/3908087 to your computer and use it in GitHub Desktop.
PHP Practice 1
<?php
//Starting values (one way to do an array)
$peopleWhoHateChris = array('Jacob');
//Adding to the array
$peopleWhoHateChris[] = 'John';
$peopleWhoHateChris[] = 'Mike';
//Another way to add
array_push($peopleWhoHateChris, 'Luke');
//Step 1: print out the number of people who hate Chris by saying "X people think Chris is a fucking asshole."
//Step 2: Print out the 3rd person who hates Chris (should be Mike)
//Step 3: Remove the last person from the array, then print out each person in a list (with a loop)
//You're gonna have to look stuff up.
//Try googling "remove last item from array php"
@loraxx753
Copy link
Author

Damnit... lemme try that again

As for how to break it up, remember you can echo html right into this, so you could do print $name."<br/>"; to add a line break between each or $name." "; for a space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment