Andres Gonzalez wrote:
Hi,
I am learning PHP and have a simple question.
I have a input string in this form:
xxx xx x xx xxx
xx x x xxx xx xx
.
.
.
xx xxx xx xx xx
each line has 6 words of various lengths, all separated by white space.
the
Hi,
I am learning PHP and have a simple question.
I have a input string in this form:
xxx xx x xx xxx
xx x x xxx xx xx
.
.
.
xx xxx xx xx xx
each line has 6 words of various lengths, all separated by white space.
the input string can have any
Nitsan Bin-Nun wrote:
$string = xxx xx x xx xxx
xxx xx x xx xxx;
$t = explode(\n, $string);
foreach ($t as $k = $v) $t[$k] = explode( , $v);
var_dump($t);
On Mon, Apr 13, 2009 at 8:55 PM, Andres Gonzalez
and...@packetstorm.comwrote:
Hi,
I am learning
Shawn McKenzie wrote:
Well in your approach you get a bunch of empty elements where the spaces
are. Here are two ways but I'm sure one preg_match_all() without the
explodes and loop could do it (some guru will show us):
//one way
$text = 'xxx xx x xx xxx
xx x x xxx
I was having the same problem. The second way was what I was looking for.
Thank you so much for your help--I did not know about preg_match_all().
very coolthanks again.
-Andres
Shawn McKenzie wrote:
Shawn McKenzie wrote:
Well in your approach you get a bunch of empty elements where
$string = xxx xx x xx xxx
xxx xx x xx xxx;
$t = explode(\n, $string);
foreach ($t as $k = $v) $t[$k] = explode( , $v);
var_dump($t);
On Mon, Apr 13, 2009 at 8:55 PM, Andres Gonzalez and...@packetstorm.comwrote:
Hi,
I am learning PHP and have a simple question.
I
Just wondering, there is callback version of preg_match_all() ? if so you
could have done it in one line I think..
On Mon, Apr 13, 2009 at 9:52 PM, Andres Gonzalez and...@packetstorm.comwrote:
I was having the same problem. The second way was what I was looking for.
Thank you so much for your
Nitsan Bin-Nun wrote:
$string = xxx xx x xx xxx
xxx xx x xx xxx;
$t = explode(\n, $string);
foreach ($t as $k = $v) $t[$k] = explode( , $v);
var_dump($t);
After assigning the string do
$string = preg_replace('/\s+/',' ',$string);
Then you should be able to do
Yeah, you rock, that works great. Not to mention you have a great name.
Jonathan Duncan
Jonathan Sharp [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
try doing this for each item:
$cartArray[] = array('itemnumber' = $itemnumber, 'brand' = $brand,
I am trying to create an array to hold shopping cart information. The array
I am using is called cartArray. What I want to do is to define a
sub-array of cartArray with the information from one product. Then the next
time a product is added it appends then new information as a second
sub-array
try doing this for each item:
$cartArray[] = array('itemnumber' = $itemnumber, 'brand' = $brand,
'quantity' = $itemqty, 'name' = $itemname);
-js
Jonathan Duncan wrote:
I am trying to create an array to hold shopping cart information. The array
I am using is called cartArray. What I want
Ok.. what I have is a database of first names and last names, and some other
columns that don't matter here.
A form is presented to a user, lets them enter a bunch of names, attributes
of the person, etc.
After submission, each record is checked against the current database to see
if the name
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 09, 2002 1:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] multi dimensional arrays / radio buttons / mass confusion
on my part
Ok.. what I have is a database of first names and last names, and some other
columns that don't matter here.
A form
-Original Message-
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 07, 2001 12:00 PM
To: PHP User Group
Subject: [PHP] Multi Dimensional Arrays?
Hello,
I am working on a menu script that I wanted to use multi-dimensional arrays
for.
Here is the conf file I have:
//Main
Anyone knows how to determine how many levels has an array?
TIA
Rom
-Original Message-
From: Robert V. Zwink [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 10:30 AM
To: Brandon Orther; PHP User Group
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Multi Dimensional Arrays?
You
PROTECTED]]
Sent: 07 May 2001 18:12
To: Brandon Orther; PHP User Group
Subject: Re: [PHP] Multi Dimensional Arrays?
I would have to say you would need a nested for loop to count
your array.
$j = 0 ;
$k = 0 ;
for ( ; $j != '' ) ; $j++ )
{
//top of the col
Hello,
I am working on a menu script that I wanted to use multi-dimensional arrays
for.
Here is the conf file I have:
//Main Menu Array
$main_menu[0] = Menu 1; //Represents the name of the menu
//Menu 1 Array
$main_menu[0][0] = Test 1;
$main_menu[0][1] = Test 2;
$main_menu[0][2] = Test 3;
under the col (by row)
echo $main_menu[$j][$k]br;
}
}
- Original Message -
From: Brandon Orther [EMAIL PROTECTED]
To: PHP User Group [EMAIL PROTECTED]
Sent: Monday, May 07, 2001 8:59 AM
Subject: [PHP] Multi Dimensional Arrays?
Hello,
I am working
18 matches
Mail list logo