Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Robert Cummings
Rene Veerman wrote: maybe you should be foreach()ing with references? php.net : search "foreach" : As of PHP 5, you can easily modify array's elements by preceding $value with &. This will assign reference instead of copying the value. This is possible only if iterated array can be referenced

Re: [PHP] Re: PHP in HTML code

2010-03-16 Thread Adam Richardson
On Tue, Mar 16, 2010 at 7:06 PM, Ashley Sheridan wrote: > On Tue, 2010-03-16 at 23:42 +0100, Rene Veerman wrote: > > > maybe adding a > then deprecating > > > On Tue, Mar 16, 2010 at 7:18 PM, tedd wrote: > > > At 5:54 PM + 3/15/10, Jochem Maas wrote: > > >> > > >> Op 3/13/10 3:49 PM, Jorge

Re: [PHP] Database vs. Array

2010-03-16 Thread Ryan Sun
Maybe you want to optimize your script first, and I don't think read entire data set into array would save you much time. Don't create new variables when its unnecessary, cache data when its necessary, try memcached, and I think heavy php cli scripts are always likely to resume a lot of resource

Re: [PHP] Database vs. Array

2010-03-16 Thread Bastien Koert
What I usually do is to pull a limited set of records ( like 10 or 50 ) and the do the operations on them, update a column in that table to mark them completed and use JavaScript to reload the page and pull the next set out where that flag field is null. No memory issue, no need to large timeouts

[PHP] Database vs. Array

2010-03-16 Thread Richard S. Crawford
I have a script that connects to an external database to process about 4,000 records. Each record needs to be operated on pretty heavily, and the script overall takes about half an hour to execute. We've hit a wall where the script's memory usage exceeds the amount allocated to PHP. I've increased

Re: [PHP] Re: PHP in HTML code

2010-03-16 Thread Ashley Sheridan
On Tue, 2010-03-16 at 23:42 +0100, Rene Veerman wrote: > maybe adding a then deprecating > On Tue, Mar 16, 2010 at 7:18 PM, tedd wrote: > > At 5:54 PM + 3/15/10, Jochem Maas wrote: > >> > >> Op 3/13/10 3:49 PM, Jorge Gomes schreef: > >>> > >>> First of all, i recommend the use of normal p

Re: [PHP] Re: PHP in HTML code

2010-03-16 Thread Rene Veerman
maybe adding a wrote: > At 5:54 PM + 3/15/10, Jochem Maas wrote: >> >> Op 3/13/10 3:49 PM, Jorge Gomes schreef: >>> >>>  First of all, i recommend the use of normal php tags () >>> because >>>  the short tags are atm marked as* **DEPRECATED*. >> >> that's a documentation error. >> >>> >>>  You

Re: [PHP] best way to set up an include path for a multi-level project?

2010-03-16 Thread Rene Veerman
On Tue, Mar 16, 2010 at 9:48 PM, Ryan Sun wrote: > just utilize include_path directive in php.ini yea, or via ini_set('include_path', ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Rene Veerman
maybe you should be foreach()ing with references? php.net : search "foreach" : As of PHP 5, you can easily modify array's elements by preceding $value with &. This will assign reference instead of copying the value. This is possible only if iterated array can be referenced (i.e. is variable),

Re: [PHP] $_FILE array being truncated

2010-03-16 Thread Rene Veerman
jumploader.com might be interesting to you.. On Tue, Mar 16, 2010 at 3:19 PM, Richard H Lee wrote: > p.general, > > I have a form with 75 or so file input controls: > Usually when I submit the form, I only upload two or so files. So in the > post request, it sends the two files along with the ot

Re: [PHP] best way to set up an include path for a multi-level project?

2010-03-16 Thread Ryan Sun
On Tue, Mar 16, 2010 at 1:57 PM, Robert P. J. Day wrote: > > and all PHP scripts would start off with something like: > > set_include_path(get_include_path() . PATH_SEPARATOR . getenv('PROJ_DIR')); > just utilize include_path directive in php.ini -- PHP General Mailing List (http://www.php.net/

Re: [PHP] best way to set up an include path for a multi-level project?

2010-03-16 Thread John Black
On 03/16/2010 08:50 PM, John Black wrote: So I just set $include = './include/abc/def/' at the top of the correction, I set $include to the relative path of the include directory and then use it like this: $include = '../../include/'; require $include.'abc/file1.php'; require_once $include.

Re: [PHP] best way to set up an include path for a multi-level project?

2010-03-16 Thread John Black
On 03/16/2010 06:57 PM, Robert P. J. Day wrote: i have a project (let's call it "proj") which lives in the "proj" directory and which contains several subdirs, some of which might contain their own subdirs and so on. some of those subdirs might contain utility classes that i want to include o

Re: [PHP] $_FILE array being truncated

2010-03-16 Thread Kim Madsen
Ashley Sheridan wrote on 16/03/2010 18:28: I really wouldn't rely on a form that contains more than 20 file upload boxes though. If someone uploads some large files, they're stuck with an extremely long wait which will slow down your server a bit as well if a lot of people are using the same for

Re: [PHP] Re: PHP in HTML code

2010-03-16 Thread tedd
At 5:54 PM + 3/15/10, Jochem Maas wrote: Op 3/13/10 3:49 PM, Jorge Gomes schreef: First of all, i recommend the use of normal php tags () because the short tags are atm marked as* **DEPRECATED*. that's a documentation error. You should also echo your values to the page, instead using

[PHP] best way to set up an include path for a multi-level project?

2010-03-16 Thread Robert P. J. Day
i have a project (let's call it "proj") which lives in the "proj" directory and which contains several subdirs, some of which might contain their own subdirs and so on. some of those subdirs might contain utility classes that i want to include or require elsewhere, so i want to be able to just:

RE: [PHP] $_FILE array being truncated

2010-03-16 Thread Richard Lee
> Check out max_file_uploads which was added in PHP 5.2.12 and defaults to > 20. Yes that was the problem, I set max_file_uploads higher and it works now. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] $_FILE array being truncated

2010-03-16 Thread Ashley Sheridan
On Tue, 2010-03-16 at 18:25 +0100, Daniel Egeberg wrote: > On Tue, Mar 16, 2010 at 15:19, Richard H Lee wrote: > > p.general, > > > > I have a form with 75 or so file input controls: > > > Usually when I submit the form, I only upload two or so files. So in the > > post request, it sends the two

Re: [PHP] $_FILE array being truncated

2010-03-16 Thread Daniel Egeberg
On Tue, Mar 16, 2010 at 15:19, Richard H Lee wrote: > p.general, > > I have a form with 75 or so file input controls: > Usually when I submit the form, I only upload two or so files. So in the > post request, it sends the two files along with the other blank 73 fields. > This has been working fin

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Robert Cummings
Peter Lind wrote: Hmm, will probably have to look inside PHP for this ... the foreach loop will copy each element as it loops over it (without actually copying, obviously), however there's no change happening to the element at any point and so there's nothing to suggest to the copy-on-write to cr

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Peter Lind
Hmm, will probably have to look inside PHP for this ... the foreach loop will copy each element as it loops over it (without actually copying, obviously), however there's no change happening to the element at any point and so there's nothing to suggest to the copy-on-write to create a new instance

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Robert Cummings
Peter Lind wrote: This is one example where references actually decrease memory usage. The main reason is the recursive nature of the function. Try BTW, it's not the recursive nature of the function causing the problem. It's the movement of the internal pointer within the array. When it moves

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Robert Cummings
Peter Lind wrote: This is one example where references actually decrease memory usage. The main reason is the recursive nature of the function. Try Doh, forgot about that :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (htt

Re: [PHP] PHP MySQL Insert Statements

2010-03-16 Thread Ryan Sun
Always make sure your dynamic sql string in php code are as expected var_dump($sql) before query On Thu, Mar 11, 2010 at 10:13 PM, Martine Osias wrote: > Hi, > > My insert statements on this web page don't execute. The select statements > do work. This tells me that the database connection is wor

Re: [PHP] PHP MySQL Insert Statements

2010-03-16 Thread Jan G.B.
2010/3/12 Martine Osias > Hi, > > My insert statements on this web page don't execute. The select statements > do work. This tells me that the database connection is working. The username > and password are the administrator's. What else could prevent the insert > statements from executing? > > T

Re: [PHP] Deleting multiple backslashes; regex?

2010-03-16 Thread Al
On 3/15/2010 5:03 PM, Jim Lucas wrote: Al wrote: Anyone have a regex pattern for deleting multiple backslashes e.g., \\\ I pretty good with regex; but, be damned if I can delete them with preg_replace() I've tried "" as the manual says preg_replace("//", '', $str); preg_replace

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Peter Lind
This is one example where references actually decrease memory usage. The main reason is the recursive nature of the function. Try wrote: > > > Richard Quadling wrote: >> >> On 15 March 2010 23:45, Daevid Vincent wrote: >>> >>> Anyone have a function that will return an integer of the number of >

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Robert Cummings
Richard Quadling wrote: On 15 March 2010 23:45, Daevid Vincent wrote: Anyone have a function that will return an integer of the number of dimensions an array has? /** * Get the maximum depth of an array * * @param array &$Data A reference to the data array * @return int The maximum numb

[PHP] $_FILE array being truncated

2010-03-16 Thread Richard H Lee
p.general, I have a form with 75 or so file input controls: Usually when I submit the form, I only upload two or so files. So in the post request, it sends the two files along with the other blank 73 fields. This has been working fine on my live and test servers so far. However as of the past

Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-16 Thread Jochen Schultz
Or maybe you want to check out this: http://www.codeplex.com/PHPExcel I havn't checked it out for your special purpose but i found it useful for some other jobs (especially excell 2007 support). regards Jochen Ashley Sheridan schrieb: On Tue, 2010-03-16 at 20:16 +0800, I am on the top of th

Re: [PHP] Need routine to tell me number of dimensions in array.

2010-03-16 Thread Richard Quadling
On 15 March 2010 23:45, Daevid Vincent wrote: > Anyone have a function that will return an integer of the number of > dimensions an array has? /** * Get the maximum depth of an array * * @param array &$Data A reference to the data array * @return int The maximum number of levels in the array.

RE: [PHP] Re: PHP in HTML code

2010-03-16 Thread Bob McConnell
From: Ford, Mike > From: Ashley Sheridan >> On Tue, 2010-03-16 at 11:16 +, Ford, Mike wrote: >> > >> > >> Proof: http://marc.info/?l=php-internals&m=126832992915664&w=2 > >> >> >> That's not really proof of anything, it's just an archived email >> from this list... > > Well, firstly it's a

Re: [PHP] Spreadsheet_Excel_Reader problem

2010-03-16 Thread Ashley Sheridan
On Tue, 2010-03-16 at 20:16 +0800, I am on the top of the world! Borlange University wrote: > i have a problem of reading values from excel file via > spreadsheet_excel_reader which is a php class used to manipulate excel > files. > > $data = new Spreadsheet_Excel_Reader(); > $data->setOutputEnco

Re: [PHP] php-cli

2010-03-16 Thread Richard Quadling
On 15 March 2010 00:27, Rick Pasotto wrote: > On Sun, Mar 14, 2010 at 08:40:51PM +, Ashley Sheridan wrote: >> On Sun, 2010-03-14 at 16:41 -0400, Rick Pasotto wrote: >> >> > On Sun, Mar 14, 2010 at 06:13:24PM +, Ashley Sheridan wrote: >> > > On Sun, 2010-03-14 at 14:15 -0400, Rick Pasotto w

[PHP] Spreadsheet_Excel_Reader problem

2010-03-16 Thread I am on the top of the world! Borlange University
i have a problem of reading values from excel file via spreadsheet_excel_reader which is a php class used to manipulate excel files. $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('CP936'); $data->read("d:\\tmp.xls"); $rows=$data->sheets[0]['numRows']; $cell = $data->sheets[0]['c

RE: [PHP] Re: PHP in HTML code

2010-03-16 Thread Ford, Mike
> -Original Message- > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] > Sent: 16 March 2010 11:16 > > On Tue, 2010-03-16 at 11:16 +, Ford, Mike wrote: > > > > > Proof: http://marc.info/?l=php-internals&m=126832992915664&w=2 > > > > That's not really proof of anything, it'

RE: [PHP] Re: PHP in HTML code

2010-03-16 Thread Ashley Sheridan
On Tue, 2010-03-16 at 11:16 +, Ford, Mike wrote: > > -Original Message- > > From: Bob McConnell [mailto:r...@cbord.com] > > Sent: 15 March 2010 18:13 > > > > From: Jochem Maas > > > > > Op 3/13/10 3:49 PM, Jorge Gomes schreef: > > >> First of all, i recommend the use of normal php ta

RE: [PHP] Re: PHP in HTML code

2010-03-16 Thread Ford, Mike
> -Original Message- > From: Bob McConnell [mailto:r...@cbord.com] > Sent: 15 March 2010 18:13 > > From: Jochem Maas > > > Op 3/13/10 3:49 PM, Jorge Gomes schreef: > >> First of all, i recommend the use of normal php tags ( ?>) > because > >> the short tags are atm marked as* **DEPRECATED