php-general Digest 16 Mar 2010 12:34:24 -0000 Issue 6642

2010-03-16 Thread php-general-digest-help
php-general Digest 16 Mar 2010 12:34:24 - Issue 6642 Topics (messages 302880 through 302889): Re: Need routine to tell me number of dimensions in array. 302880 by: Ashley Sheridan 302881 by: Jim Lucas 302882 by: Robert Cummings Re: PHP in HTML code 302883

php-general Digest 17 Mar 2010 00:55:41 -0000 Issue 6643

2010-03-16 Thread php-general-digest-help
php-general Digest 17 Mar 2010 00:55:41 - Issue 6643 Topics (messages 302890 through 302919): Re: Need routine to tell me number of dimensions in array. 302890 by: Richard Quadling 302893 by: Robert Cummings 302894 by: Peter Lind 302898 by: Robert Cummings

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 (?php ... ?) because the short tags are atm marked as* **DEPRECATED*.

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 tags (?php ... ?)

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-internalsm=126832992915664w=2 That's not really proof of anything, it's just an

[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 =

Re: [PHP] php-cli

2010-03-16 Thread Richard Quadling
On 15 March 2010 00:27, Rick Pasotto r...@niof.net 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

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();

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-internalsm=126832992915664w=2 That's not really proof of anything, it's just an archived email from this list... Well, firstly it's an archived email from

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 dae...@daevid.com 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

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

[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: input type=file ... 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.

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 dae...@daevid.com 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

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 ?php echo memory_get_usage() . PHP_EOL; $array = range(0,100); $array[10] = range(0,10); $array[20] = range(0,10); $array[30] = range(0,10); $array[40] =

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);

Re: [PHP] PHP MySQL Insert Statements

2010-03-16 Thread Jan G.B.
2010/3/12 Martine Osias webi...@gmail.com 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

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 webi...@gmail.com wrote: Hi, My insert statements on this web page don't execute. The select statements do work. This tells me that the database

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 ?php echo memory_get_usage() . PHP_EOL; $array = range(0,100); $array[10] = range(0,10); $array[20] = range(0,10); $array[30] = range(0,10);

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

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: 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

Re: [PHP] $_FILE array being truncated

2010-03-16 Thread Daniel Egeberg
On Tue, Mar 16, 2010 at 15:19, Richard H Lee rich...@webdezign.co.uk wrote: p.general, I have a form with 75 or so file input controls: input type=file ... 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

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 rich...@webdezign.co.uk wrote: p.general, I have a form with 75 or so file input controls: input type=file ... Usually when I submit the form, I only upload two or so files. So in the

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

[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] 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 (?php ... ?) because the short tags are atm marked as* **DEPRECATED*. that's a documentation error. You should also echo your values to the page,

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

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 or

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

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 rpj...@crashcourse.ca 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

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 rich...@webdezign.co.uk wrote: p.general, I have a form with 75 or so file input controls: input type=file ... Usually when I submit the form, I only upload two or so files. So in the post request,

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. ?php $arr = array(1, 2, 3, 4); foreach ($arr as $value) { $value = $value * 2;

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 ryansu...@gmail.com 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] Re: PHP in HTML code

2010-03-16 Thread Rene Veerman
maybe adding a ?php= as equivalent to ?= and ?php echo , then deprecating ?= would be useful. On Tue, Mar 16, 2010 at 7:18 PM, tedd tedd.sperl...@gmail.com 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

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 ?php= as equivalent to ?= and ?php echo , then deprecating ?= would be useful. On Tue, Mar 16, 2010 at 7:18 PM, tedd tedd.sperl...@gmail.com wrote: At 5:54 PM + 3/15/10, Jochem Maas wrote: Op 3/13/10 3:49 PM,

[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] 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

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

Re: [PHP] Re: PHP in HTML code

2010-03-16 Thread Adam Richardson
On Tue, Mar 16, 2010 at 7:06 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2010-03-16 at 23:42 +0100, Rene Veerman wrote: maybe adding a ?php= as equivalent to ?= and ?php echo , then deprecating ?= would be useful. On Tue, Mar 16, 2010 at 7:18 PM, tedd

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. ?php $arr = array(1, 2, 3, 4); foreach ($arr as $value) {