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 in
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
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 wrote:
> 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 kno
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 t
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
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
> wrote:
>
>> Hi,
>>
>> I am learning PHP
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
$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 wrote:
> Hi,
>
> I am learning PHP and have a simple question.
> I have a inpu
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,
>
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
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-arra
From: Chad Day [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 mat
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 cu
:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 10:55 AM
To: Robert V. Zwink; PHP User Group
Subject: RE: [PHP] Multi Dimensional Arrays?
Anyone knows how to determine how many levels has an array?
TIA
Rom
-Original Message-
From: Robert V. Zwink [mailto:[EMAIL PROTECTED]]
Sent: Tuesday
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 are
e through each element
incrementing a counter to do so. Just use count(). It works fine on
multi-dimensional arrays.
Robert Zwink
-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
PROTECTED] [mailto:[EMAIL 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
// then everything under the col (by row)
echo "$main_menu[$j][$k]";
}
}
- Original Message -
From: "Brandon Orther" <[EMAIL PROTECTED]>
To: "PHP User Group" <[EMAIL PROTECTED]>
Sent: Monday, May
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
19 matches
Mail list logo