Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Problem when i execute my php

Codes here !

Moderators: macek, egami, gesf

Problem when i execute my php

Postby Hamza17 » Mon Mar 25, 2013 2:38 am

I have this code but when i execute it it says Notice: Undefined variable: exp in C:\Yoututs\ProbabilityDistribution\time.php on line 4

Fatal error: Call to a member function InverseCDF() on a non-object in C:\Yoututs\ProbabilityDistribution\time.php on line 4
Code: Select all
<?php

$prob = 0.25;
$num_mins = $exp->InverseCDF($prob) * $mins_per_game;
echo "In 25 percent of games, a goal will occur within $num_mins
     minutes of play.<br>";

$prob = 0.50;
$num_mins = $exp->InverseCDF($prob) * $mins_per_game;
echo "In 50 percent of games, a goal will occur within $num_mins
     minutes of play.<br>";

$prob = 0.75;
$num_mins = $exp->InverseCDF($prob) * $mins_per_game;
echo "In 75 percent of games, a goal will occur within $num_mins
     minutes of play.<br>";

?>

and the same happen with this code. it says: Notice: Undefined variable: exp in C:\Yoututs\ProbabilityDistribution\time.php on line 7

Fatal error: Call to a member function CDF() on a non-object in C:\Yoututs\ProbabilityDistribution\time.php on line 7
Code: Select all
<?php

$mins = 10;
$mins_per_game = 90;
$interval = $mins / $mins_per_game;
echo "Probability of goal in t <= 10 mins: ". $exp->CDF($interval);

?>

Please i will b grateful if someonee know how to fix it, i hope your answer it's about an important project
Hamza17
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Mar 25, 2013 2:23 am

Re: Problem when i execute my php

Postby seandisanti » Mon Mar 25, 2013 7:49 am

You're using $exp without declaring it. It looks like you've left out this line:
Code: Select all

$exp 
= new PHPMath_ProbabilityDistribution_Exponential($rate); 
 
and probably some more. I'd say go back to the place you're copying your code from and start over, just to be safe
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.