$gln=gammln($a);
if ($x <= 0.0) {
if ($x < 0.0) echo "x less than 0 in routine GSER";
$gamser=0.0;
return;
} else {
$ap=$a;
$sum=1.0/$a;
$del=$sum;
for ($n=1;$n<=ITMAX;$n++) {
$ap += 1.0;
$del *= $x/$ap;
$sum += $del;
if (abs($del) < abs($sum)*EPS) {
$gamser=$sum*exp(-$x+$a*log($x)-($gln));
return;
}
}
echo "a=$a too large, ITMAX = $itmax too small in routine GSER ";
return;
}
}
function gcf( &$gammcf,$a,$x,&$gln)
{
$gold=0.0;
$fac=1.0;
$b1=1.0;
$b0=0.0;
$a0=1.0;
$gln=gammln($a);
$a1=$x;
for ($n=1;$n<=ITMAX;$n++) {
$an=(double) $n;
$ana=$an-$a;
$a0=($a1+$a0*$ana)*$fac;
$b0=($b1+$b0*$ana)*$fac;
$anf=$an*$fac;
$a1=$x*$a0+$anf*$a1;
$b1=$x*$b0+$anf*$b1;
if ($a1) {
$fac=1.0/$a1;
$g=$b1*$fac;
if (abs(($g-$gold)/$g) < EPS) {
$gammcf=exp(-$x+$a*log($x)-($gln))*$g;
return;
}
$gold=$g;
}
}
echo "a too large, ITMAX too small in routine GCF ";
}
function gammp($a,$x)
{
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: there must be better way to handle "Null" undefinedvariables
am 08.12.2008 18:00:36 von Justin
This is more a matter of a php.ini setting. Check the values of
error_reporting in both your php.ini on the Windows and Linux boxes.
My guess is your windows value is E_ALL.
-Justin
Fred Silsbee wrote:
> Problem with the code below
>
> Works perfectly under Linux Fedora 9 however
>
> Under windows, the first page has an error Notice: Undefined variable: ExercisePrice in C:\Inetpub\wwwroot\new_black_scholes.php on line 198
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: there must be better way to handle "Null" undefined variables
am 08.12.2008 19:04:49 von Fred Silsbee
YES! I am working on another php script to connect to MS SQL Server!
I need all the clues I can get to get it working!
Great clues searching php.net site!
Meanwhile I get the hokey error in my boxes
I did fix the problem but my code is gloating!
--- On Mon, 12/8/08, justin wrote:
> From: justin
> Subject: Re: [PHP-WIN] there must be better way to handle "Null" undefined variables
> To: fredsilsbee@yahoo.com
> Cc: php-windows@lists.php.net
> Date: Monday, December 8, 2008, 5:00 PM
> This is more a matter of a php.ini setting. Check the
> values of
> error_reporting in both your php.ini on the Windows and
> Linux boxes.
> My guess is your windows value is E_ALL.
>
> -Justin
>
> Fred Silsbee wrote:
> > Problem with the code below
> >
> > Works perfectly under Linux Fedora 9 however
> >
> > Under windows, the first page has an error
> />Notice: Undefined variable:
> ExercisePrice in
> C:\Inetpub\wwwroot\new_black_scholes.php
> on line 198
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: there must be better way to handle "Null" undefined variables
am 08.12.2008 19:06:23 von Daniel Brown
For future reference, Fred, please only include the relevant code,
not the entire script.
On Mon, Dec 8, 2008 at 11:46 AM, Fred Silsbee wrote:
[snip!]
>
> Under windows, the first page has an error Notice: Undefined variable: ExercisePrice in C:\Inetpub\wwwroot\new_black_scholes.php on line 198
This is just a matter of the INI settings error_reporting and/or
error_display being different. It's not an OS thing at all. You can
change php.ini on the offending system to this:
error_reporting = E_ALL | ~E_NOTICE
; Note that the | is the pipe character.
Preferably, though, the variable on line 198 should be defined.
It doesn't absolutely *NEED* to be, but good coding standards beg that
you do.
[snip!]
>
> value="" />
[snip!]
There's your problem. $ExercisePrice is called (within the
?> tags), but was never defined before this.
--
http://www.parasane.net/
daniel.brown@parasane.net || danbrown@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: there must be better way to handle "Null" undefined variables
am 08.12.2008 19:24:50 von Fred Silsbee
if you read my original post you'd see that I already know this!
I even inserted code to fix the problem. The problem is that the
values of the variable THE FIRST TIME are undefined as shown by the code I
inserted.
I fixed the problem for one of the variables to make sure I perceived the
problem correctly not being a html guru!
The question is again "Is there a better way?"
--- On Mon, 12/8/08, Daniel Brown wrote:
> From: Daniel Brown
> Subject: Re: [PHP-WIN] there must be better way to handle "Null" undefined variables
> To: fredsilsbee@yahoo.com
> Cc: php-windows@lists.php.net
> Date: Monday, December 8, 2008, 6:06 PM
> For future reference, Fred, please only include the relevant
> code,
> not the entire script.
>
> On Mon, Dec 8, 2008 at 11:46 AM, Fred Silsbee
> wrote:
> [snip!]
> >
> > Under windows, the first page has an error
> />Notice: Undefined variable:
> ExercisePrice in
> C:\Inetpub\wwwroot\new_black_scholes.php
> on line 198
>
> This is just a matter of the INI settings
> error_reporting and/or
> error_display being different. It's not an OS thing at
> all. You can
> change php.ini on the offending system to this:
>
> error_reporting = E_ALL | ~E_NOTICE
> ; Note that the | is the pipe character.
>
> Preferably, though, the variable on line 198 should be
> defined.
> It doesn't absolutely *NEED* to be, but good coding
> standards beg that
> you do.
>
> [snip!]
> >
> size="20" maxlength="40"
> name="ExercisePrice"
> > value="
> ?>" />
> [snip!]
>
> There's your problem. $ExercisePrice is called
> (within the
> ?> tags), but was never defined before this.
>
> --
>
> http://www.parasane.net/
> daniel.brown@parasane.net || danbrown@php.net
> 50% Off Hosting! http://www.pilotpig.net/specials.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: there must be better way to handle "Null" undefined variables
am 08.12.2008 19:32:01 von Daniel Brown
On Mon, Dec 8, 2008 at 1:24 PM, Fred Silsbee wrote:
> if you read my original post you'd see that I already know this!
Fred, I read your original post (the whole thing, which - if you
read the rules of these mailing lists, you'd see - you sent wrong, as
usual).
> The question is again "Is there a better way?"
The BETTER way is doing it the RIGHT way, and not being so
abrasive with every single post you make to the mailing lists. If you
already know the problem and how to fix it, then what's the issue
here? Fix it.
--
http://www.parasane.net/
daniel.brown@parasane.net || danbrown@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: there must be better way to handle "Null" undefinedvariables
am 08.12.2008 19:40:34 von James Crow
On Mon, 2008-12-08 at 10:24 -0800, Fred Silsbee wrote:
> if you read my original post you'd see that I already know this!
>
> I even inserted code to fix the problem. The problem is that the
>
> values of the variable THE FIRST TIME are undefined as shown by the code I
>
> inserted.
>
> I fixed the problem for one of the variables to make sure I perceived the
>
> problem correctly not being a html guru!
>
> The question is again "Is there a better way?"
>
>
If I write code that may be on a server I do not or can not control the
php.ini settings, I check for the existence of the variable before I use
it. This does increase the code size somewhat, but it makes the code
more reliable as well. If you are passing values through HTTP Post or
Get you will need something like this anyway to keep from typing the
super global variable name every time.
if (get_magic_quotes_gpc())
{
// this should not be needed, but
//some sites still use get_magic_quotes_gpc
if (array_key_exists('my_html_var', $_POST)
$my_html_var = stripslashes($_POST['my_html_var']);
}
else
{
if (array_key_exists('my_html_var', $_POST)
$my_html_var = $_POST['my_html_var'];
}
if (!is_set($my_html_var))
{
// set our variable to a known value
$my_html_var = 'somevalue';
}
Cheers,
James
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: there must be better way to handle "Null" undefined variables
am 08.12.2008 19:55:56 von Fred Silsbee
--- On Mon, 12/8/08, James Crow wrote:
> From: James Crow
> Subject: Re: [PHP-WIN] there must be better way to handle "Null" undefined variables
> To: fredsilsbee@yahoo.com
> Cc: "Daniel Brown" , php-windows@lists.php.net
> Date: Monday, December 8, 2008, 6:40 PM
> On Mon, 2008-12-08 at 10:24 -0800, Fred Silsbee wrote:
> > if you read my original post you'd see that I
> already know this!
> >
> > I even inserted code to fix the problem. The problem
> is that the
> >
> > values of the variable THE FIRST TIME are undefined as
> shown by the code I
> >
> > inserted.
> >
> > I fixed the problem for one of the variables to make
> sure I perceived the
> >
> > problem correctly not being a html guru!
> >
> > The question is again "Is there a better
> way?"
> >
> >
>
> If I write code that may be on a server I do not or can not
> control the
> php.ini settings, I check for the existence of the variable
> before I use
> it. This does increase the code size somewhat, but it makes
> the code
> more reliable as well. If you are passing values through
> HTTP Post or
> Get you will need something like this anyway to keep from
> typing the
> super global variable name every time.
>
> if (get_magic_quotes_gpc())
> {
> // this should not be needed, but
> //some sites still use get_magic_quotes_gpc
> if (array_key_exists('my_html_var', $_POST)
> $my_html_var =
> stripslashes($_POST['my_html_var']);
> }
> else
> {
> if (array_key_exists('my_html_var', $_POST)
> $my_html_var = $_POST['my_html_var'];
> }
> if (!is_set($my_html_var))
> {
> // set our variable to a known value
> $my_html_var = 'somevalue';
> }
>
> Cheers,
> James
your general concept is correct...do it the right way
I am not adhering to MY way but why isn't my fix OK?
One variable fixed...fixing the rest would cause code gloat.
I had a (flying) instrument instructor once who was famous for his teaching ability.
If I made a mistake (and I did many times) he'd tell me why so I'd learn the concept.
Thanks!
BTW is there anything you consider abrasive in my posts?
I am to the point to avoid post proliferation.
Here is only the pertinent code!
Re: there must be better way to handle "Null" undefined variables
am 08.12.2008 20:19:47 von Niel Archer
> your general concept is correct...do it the right way
>
> I am not adhering to MY way but why isn't my fix OK?
>
> One variable fixed...fixing the rest would cause code gloat.
I think you mean Bloat. Code doesn't take satisfaction from ruining
your day, it just feels like it does.
> I had a (flying) instrument instructor once who was famous for his teaching ability.
>
> If I made a mistake (and I did many times) he'd tell me why so I'd learn the concept.
>
> Thanks!
>
> BTW is there anything you consider abrasive in my posts?
>
> I am to the point to avoid post proliferation.
>
> Here is only the pertinent code!
>
>