jeddi
02-24-2012, 09:29 AM
Hi,
I have a user input where they can input a list of keywords, ( just text input up tp 100 chars ). After santitising the input I get:
$keywords = "Simple Page, create website, free web page, simple website, eesy page, make easy page";
What I want to derive from this is a set of five individual keywords
like this:
$key_array = array();
$key1 = $key_array[0];
$key2 = $key_array[1];
$key3 = $key_array[2];
$key4 = $key_array[3];
$key5 = $key_array[4];
My question is: how do I get the data from $keywords
into my $key_array array AND how do I ONLY take the first 5 ?
So if there are six comma separated phrases in $keywords, (like above) I only want the first five.
If there are only three comma separated phrases in $keywords what will happen ? It mustn't "fail" - I need to "pad" the missing keys with some relevant data.
Thanks for any help.
.
I have a user input where they can input a list of keywords, ( just text input up tp 100 chars ). After santitising the input I get:
$keywords = "Simple Page, create website, free web page, simple website, eesy page, make easy page";
What I want to derive from this is a set of five individual keywords
like this:
$key_array = array();
$key1 = $key_array[0];
$key2 = $key_array[1];
$key3 = $key_array[2];
$key4 = $key_array[3];
$key5 = $key_array[4];
My question is: how do I get the data from $keywords
into my $key_array array AND how do I ONLY take the first 5 ?
So if there are six comma separated phrases in $keywords, (like above) I only want the first five.
If there are only three comma separated phrases in $keywords what will happen ? It mustn't "fail" - I need to "pad" the missing keys with some relevant data.
Thanks for any help.
.