I have a variable v with the value -1. After v++ it has the value "" not
0. Since I am using it for a subscript, the "" value is not overwriting
the 0 element of the array as desired. Should v++ ever give a
non-numeric value? 9 1248
On Thu, 27 Jul 2006 17:47:50 -0400, Bob Stearns <rs**********@charter.net>
wrote:
>I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
No - post a script and output demonstrating this?
Since you're not on the latest release of a branch the standard advice would
be "upgrade", though, if this actually happens.
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
"Bob Stearns" <rs**********@charter.netwrote in message
news:bw****************@fe04.lga...
>I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
I used to use a variable initialised with -1, and never noticed the problem
you are having.
What are you trying to do with it and have you got an example of the code so
we can see what's going on?
Phil
Andy Hassall wrote:
On Thu, 27 Jul 2006 17:47:50 -0400, Bob Stearns <rs**********@charter.net>
wrote:
>>I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
No - post a script and output demonstrating this?
Since you're not on the latest release of a branch the standard advice would
be "upgrade", though, if this actually happens.
Here is a script fragment and the debugging output therefrom:
dosql($sql, "S AUI 3", -1, "", $res, $n);
$debug .= "<br>stk_ptr=$stk_ptr; ";
while($x=odbc_fetch_array($res)) {
$debug .= "<br>x="; debug_var($x); $debug .= "<br>";
$item_list[$n_animals] = $x["ITEM_ID"];
$free = $x["FREE_PART"];
$free_list[$n_animals] = $free;
if($free!="Y") $chg_animals++;
$n_animals++;
$stk_ptr++;
$stack[$stack_ptr] = array($x["LOT_NUMB"], $x["LOT_SUFFIX"]);
$debug .= "<br>stk_ptr=$stkptr; stack=";
debug_var($stack);
$debug .= "<br>";
stk_ptr=-1;
x=array 14 { ITEM_ID=>29; AUCTION_ID=>21; BHID=>77143; LOT_NUMB=>11;
LOT_SUFFIX=>; SALE_ORDER=>; FOOTNOTES=>; CATALOG_UPDATE=>; COMMENTX=>;
PRINT_CATALOG=>Y; PART_OF_LOT_NUMB=>13; PART_OF_LOT_SUFFIX=>;
FREE_PART=>Y; CATEGORY=>; }
stk_ptr=; stack=array 2 { 0=>array 2 { 0=>13; 1=>; }
=>array 2 { 0=>11; 1=>; }
}
As you can see, stk_ptr is "", and so when it is used as a subscript,
stack[0] is not overwritten, which hangs the whole script in an infinite
loop.
PTM wrote:
"Bob Stearns" <rs**********@charter.netwrote in message
news:bw****************@fe04.lga...
>>I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
I used to use a variable initialised with -1, and never noticed the problem
you are having.
What are you trying to do with it and have you got an example of the code so
we can see what's going on?
Phil
Here is a script fragment and the debugging output therefrom:
dosql($sql, "S AUI 3", -1, "", $res, $n);
$debug .= "<br>stk_ptr=$stk_ptr; ";
while($x=odbc_fetch_array($res)) {
$debug .= "<br>x="; debug_var($x); $debug .= "<br>";
$item_list[$n_animals] = $x["ITEM_ID"];
$free = $x["FREE_PART"];
$free_list[$n_animals] = $free;
if($free!="Y") $chg_animals++;
$n_animals++;
$stk_ptr++;
$stack[$stack_ptr] = array($x["LOT_NUMB"], $x["LOT_SUFFIX"]);
$debug .= "<br>stk_ptr=$stkptr; stack=";
debug_var($stack);
$debug .= "<br>";
stk_ptr=-1;
x=array 14 { ITEM_ID=>29; AUCTION_ID=>21; BHID=>77143; LOT_NUMB=>11;
LOT_SUFFIX=>; SALE_ORDER=>; FOOTNOTES=>; CATALOG_UPDATE=>; COMMENTX=>;
PRINT_CATALOG=>Y; PART_OF_LOT_NUMB=>13; PART_OF_LOT_SUFFIX=>;
FREE_PART=>Y; CATEGORY=>; }
stk_ptr=; stack=array 2 { 0=>array 2 { 0=>13; 1=>; }
=>array 2 { 0=>11; 1=>; }
}
As you can see, stk_ptr is "", and so when it is used as a subscript,
stack[0] is not overwritten, which hangs the whole script in an infinite
loop.
On Thu, 27 Jul 2006 18:14:02 -0400, Bob Stearns <rs**********@charter.net>
wrote:
>Andy Hassall wrote:
>On Thu, 27 Jul 2006 17:47:50 -0400, Bob Stearns <rs**********@charter.net> wrote:
>>>I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
No - post a script and output demonstrating this?
Since you're not on the latest release of a branch the standard advice would be "upgrade", though, if this actually happens.
Here is a script fragment and the debugging output therefrom:
[snip]
> stk_ptr=; stack=array 2 { 0=>array 2 { 0=>13; 1=>; } =>array 2 { 0=>11; 1=>; } }
As you can see, stk_ptr is "", and so when it is used as a subscript, stack[0] is not overwritten, which hangs the whole script in an infinite loop.
Can you reduce this to a script that can be run stand-alone?
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
*** Bob Stearns escribió/wrote (Thu, 27 Jul 2006 17:47:50 -0400):
I have a variable v with the value -1. After v++ it has the value "" not
0. Since I am using it for a subscript, the "" value is not overwriting
the 0 element of the array as desired. Should v++ ever give a
non-numeric value?
Can you post actual PHP code we can copy, paste and try?
Never mind, I suppose you're casting numbers from/to strings. Check the
"Type Juggling" chapter in PHP manual.
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Alvaro G. Vicario wrote:
*** Bob Stearns escribió/wrote (Thu, 27 Jul 2006 17:47:50 -0400):
>>I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
Can you post actual PHP code we can copy, paste and try?
Never mind, I suppose you're casting numbers from/to strings. Check the
"Type Juggling" chapter in PHP manual.
My error. Twice I mistyped the variable $stk_ptr; once as $stkptr and
once as $stack_ptr. The errors offset each other in such a way as to
lead me to the erroneous conclusion about ++.
Andy Hassle wrote:
On Thu, 27 Jul 2006 18:14:02 -0400, Bob Stearns <rs**********@charter.net>
wrote:
>>Andy Hassall wrote:
>>>On Thu, 27 Jul 2006 17:47:50 -0400, Bob Stearns <rs**********@charter.net> wrote:
I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
No - post a script and output demonstrating this?
Since you're not on the latest release of a branch the standard advice would be "upgrade", though, if this actually happens. Here is a script fragment and the debugging output therefrom:
[snip]
>>stk_ptr=; stack=array 2 { 0=>array 2 { 0=>13; 1=>; } =>array 2 { 0=>11; 1=>; } }
As you can see, stk_ptr is "", and so when it is used as a subscript, stack[0] is not overwritten, which hangs the whole script in an infinite loop.
Can you reduce this to a script that can be run stand-alone?
My error. Twice I mistyped the variable $stk_ptr; once as $stkptr and
once as $stack_ptr. The errors offset each other in such a way as to
lead me to the erroneous conclusion about ++.
Bob Stearns wrote:
(..)
My error. Twice I mistyped the variable $stk_ptr; once as $stkptr and
once as $stack_ptr. The errors offset each other in such a way as to
lead me to the erroneous conclusion about ++.
Hi Bob,
If you set error reporting to E_ALL php will tell you about these
typo's. Once you got your code cleaned up it can save you a lot of time ;-)
call from the top of your script:
error_reporting(E_ALL);
or in php.ini change the line:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
into:
error_reporting = E_ALL & ~E_STRICT
(for php4 leave out & ~E_STRICT)
Greetings,
Henk Verhoeven, www.phpPeanuts.org. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dominik B. |
last post by:
I'm executing these commands:
$text="example text";
$parts=explode(" ", $text);
$result=$parts;
$result becomes a weird array.
echo "$result" prints 'example',
|
by: redneck_kiwi |
last post by:
All:
I have an application that has been working well for 3-4 months now
without any issues (that I am aware of). A day or two ago, one of our
employees that use this application called to say...
|
by: redneck_kiwi |
last post by:
Hi all:
I have a really weird problem. I am developing a customer catalog
system for my company and as such have delved into sessions for
authentication and access levels. So far, I have managed...
|
by: Skybuck Flying |
last post by:
This is the source code for nrand48 from gnuwin32 libgw32c
long int nrand48 (xsubi) unsigned short int xsubi;
{
long int result;
(void) __nrand48_r (xsubi, &__libc_drand48_data, &result);
...
|
by: Dees |
last post by:
Hi,
I am facing a weird problem with HTTPS and Request.Url.AbsoluteUri in my
ASP.NET application. Here is the scenario -
1. I have a menu page (Default.aspx), which has the following anchor -...
|
by: Bo Peng |
last post by:
Dear list,
I spent the last 12 hours in catching this bug (?) and what I found out
is very difficult to explain:
Basically, I need to call a user-provided function many times, with a
tuple as...
|
by: Mick_fae_Glesga |
last post by:
OK, the solution to this is probably blindingly obvious to everyone,
but... surely it can't be right.
I am compiling with borland bcc32 free compiler
this piece of code is designed to identify...
|
by: jerrygarciuh |
last post by:
Hi all,
The following script is giving me weird problems. I have in this
directory an index.php and hurricane.php.
If the script gets $i = 'on' it is supposed to back up the current
index...
|
by: dtschoepe |
last post by:
Hi,
I am working on a project for school and I am trying to get my head
around something weird. I have a function setup which is used to get
an input from stdin and a piece of memory is created...
|
by: Bill Nguyen |
last post by:
I'm running into a very weird problem regarding subtraction.
Subtraction behaves as if it's an addition in the below sub
txtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0")
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |