help me with code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
avera
Forum Newbie
Posts: 3
Joined: Mon May 26, 2008 1:27 am

help me with code

Post by avera »

Can someone tell me what these things do

Code: Select all

$a = $_POST['b'];
if ($a[0] == 'a' || $a[0] == 'A,') {
    echo 'ohhoo';
} else {
    echo 'ehhee';
}
//

Code: Select all

 
$a = $_POST['b'];
$c = explode (' ',$a);
shuffle($c);
echo implode(' ',$c)
;
hansford
Forum Commoner
Posts: 91
Joined: Mon May 26, 2008 12:38 am

Re: help me with code

Post by hansford »

$a = $_POST['b']; //takes form value named 'b' and puts in var $a
if ($a[0] == 'a' || $a[0] == 'A,') { //checks if first char is an 'a' or 'A'
echo 'ohhoo'; //if it is then display this 'ohhoo'
} else {
echo 'ehhee'; //if not then display this 'ehhee'
}

$a = $_POST['b'];
$c = explode (' ',$a); //split the 'string' at each blank space and store values in array named $c
shuffle($c); //mix up the array
echo implode(' ',$c) put the array back together into a string
----------------------------------------
search in google for each function ie shuffle(), implode() etc
avera
Forum Newbie
Posts: 3
Joined: Mon May 26, 2008 1:27 am

Re: help me with code

Post by avera »

thanks:D
Post Reply