Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-16-2005, 11:56 AM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
In the subsequent PHP script (after t he form was submitted), $hobbies would be a string array (thus the []) and its values would be the values (as specified on the individual input tags) that the user had selected on the form.
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
 
Register now for full access!
Old 06-16-2005, 12:56 PM
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
cool ok got another question if i use this bit of code first of all is this teling it to turn the string $ints into this array interests my qUESTION IS WHAT DOES THE (',', THAT DO IN THIS BIT CODE


}$ints = implode (',', $_POST['interests']);


also this code here what does the <pre> tag do and also where is say echo "$key\t$value\n"; why is there a t before $value


<?php
# script 2.13 - sorting.php

//create the array.
$movies=array('10' =>'cosablanca',
'9.65' => 'to kill a mockingbird',
'2.35' => ' the english patient',
'8' => ' traffic');

//display the movies in their original order:
echo 'in there original order:
<br /><pre> Rating Title ';
foreach ($movies as $key => $value){

echo "$key\t$value\n";
}
echo '</pre>';

//display the movies sorted by title:
echo 'sorted by title:<br /><pre>Rating title:';
asort ($movies);
foreach ($movies as $key => $value){
echo "$key\t$value\n";
}
echo '</pre>';

//display the movies sorted by rating:
echo 'sorted by rating:<br /><pre>Rating title';
krsort($movies);
foreach ($movies as $key => $value){
echo "$key\t$value\n";
}
echo '</pre>';

?>

Last edited by millwalll; 06-16-2005 at 01:39 PM..
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Old 06-16-2005, 01:31 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
That code creates a comma-separated string of values combining all the values in the array $_POST[interests].

implode() takes a delimiter and an array. It concatenates all the values of the array separated by the delimiter string between each. See http://www.php.net/implode
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 06-16-2005, 02:05 PM
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
ok what about the <pre> tag do and also where is say echo "$key\t$value\n"; why is there a t before $value is this part of the implode
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Old 06-16-2005, 02:33 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
The <pre> tag is an HTML tag -- preformatted text. It has nothing to do with the PHP script. See http://www.w3schools.com/tags/tag_pre.asp.

The \t is how you specify a tab character to be printed.
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 06-16-2005, 02:42 PM
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
chears kyrnt
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Reply     « Reply to php help

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34672 seconds with 11 queries