[PHP] Desperate!!!!!!! Resource id #24 - error???????????

2002-03-22 Thread brendan conroy

Hi guys,
Thanks for reading this. I desperatley need help with this error. I 
just finished a huge project thats taken me months, my code works, but the 
code its attached to has an error. The project is due Monday and naturally 
enough the guy who wrote the code with the error is gone on holiday for the 
weekend- typical.

Does anyone know what the hell Resource id's are, and why they are showing 
up in my array instead of good ol fashioned numbers?

My array goes (correct)into a function looking like this :

Array ( [0] = Array ( [0] = -1 [1] = 1 [2] = 1 [3] = 1 ) [1] = Array ( 
[0] = -2 [1] = 2 [2] = 2 [3] = 10 [4] = 2 ) [2] = Array ( [0] = -3 
[1] = 3 [2] = 3 [3] = 9 ) ) Array ( [0] = Array ( [0] = -4 [1] = 4 [2] 
= 4 [3] = 4 ) [1] = Array ( [0] = -5 [1] = 5 [2] = 5 [3] = 5 ) [2] = 
Array ( [0] = -6 [1] = 6 [2] = 6 [3] = 6 ) )

and comes out looking like this:

Array ( [0] = Array ( [0] = Resource id #5 [1] = Resource id #8 [2] = 1 
[3] = 1 ) [1] = Array ( [0] = Resource id #16 [1] = Resource id #17 [2] 
= 2 [3] = 10 [4] = 2 [5] = ) [2] = Array ( [0] = Resource id #24 [1] 
= Resource id #25 [2] = 3 [3] = 9 ) ) Array ( [0] = Array ( [0] = 
Resource id #35 [1] = Resource id #36 [2] = 4 [3] = 4 ) [1] = Array ( 
[0] = Resource id #44 [1] = Resource id #45 [2] = 5 [3] = 5 ) [2] = 
Array ( [0] = Resource id #53 [1] = Resource id #54 [2] = 6 [3] = 6 ) )

The Resource id #'s only go into the first two places in the end(third) 
arrays.


I'd really appreciate help with this


Thanks a million



_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Desperate!!!!!!! Resource id #24 - error???????????

2002-03-22 Thread Jason Wong

On Saturday 23 March 2002 01:53, brendan conroy wrote:
 Hi guys,
 Thanks for reading this. I desperatley need help with this error. I
 just finished a huge project thats taken me months, my code works, but the
 code its attached to has an error. The project is due Monday and naturally
 enough the guy who wrote the code with the error is gone on holiday for the
 weekend- typical.

Let's see the code that its attached to.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Slang is language that takes off its coat, spits on its hands, and goes to 
work.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Desperate!!!!!!! Resource id #24 - error???????????

2002-03-22 Thread Jason Wong

Thank you for (mis)placing your faith in me. But if you want a better quality 
of help you should write to the list and not to any one individual.



On Saturday 23 March 2002 02:44, brendan conroy wrote:
 OK here goes, Im pretty sure the error is in the monic function, thanks for
 your time on this

 ?
 function grobmonic($g)
 {

   for($c=0;$ccount($g);$c++)
   {
   $g[$c]=monic($g[$c]);
   }
 return $g;
 }
 ?


 ?
 function monic($p)
 {
   print_r($p);
   if(gmp_cmp($p[0][0],$p[0][1])!=0)
   {
   $temp[0]=$p[0][1];
 $temp[1]=$p[0][0];
   $p=prodmono($temp,$p);
   }
 return $p;
 }
 ?




 ?
 function prodmono($p1,$p2)
 {

   for($a=0;$acount($p2);$a++)
 {

   $num=gmp_mul($p1[0],$p2[$a][0]);

 $den=gmp_mul($p1[1],$p2[$a][1]);
   $g=gmp_gcd($num,$den);
   if(gmp_cmp($g,1)!=0)
   {
   $num=gmp_divexact($num,$g);
   $den=gmp_divexact($den,$g);
   }
   $res[$a][0]=$num;
 $res[$a][1]=$den;
   $k=$i=$j=2;
   while($icount($p1)  $jcount($p2[$a]))
   {
   if($p1[$i]$p2[$a][$j])
   {
   $res[$a][$k]=$p1[$i];
   $res[$a][$k+1]=$p1[$i+1];
   $i=$i+2;
   }
   elseif($p1[$i]$p2[$a][$j])
   {
 $res[$a][$k]=$p2[$a][$j];
 $res[$a][$k+1]=$p2[$a][$j+1];
 $j=$j+2;
 }
   else
   {
 $res[$a][$k]=$p1[$i];
 $res[$a][$k+1]=$p1[$i+1]+$p2[$a][$j+1];
 $i=$i+2;
   $j=$j+2;
 }
   $k=$k+2;
   }
   while($icount($p1))
   {
   $res[$a][$k]=$p1[$i];
 $res[$a][$k+1]=$p1[$i+1];
 $i=$i+2;
   $k=$k+2;
 }
 while($jcount($p2[$a]))
 {
 $res[$a][$k]=$p2[$a][$j];
 $res[$a][$k+1]=$p2[$a][$j+1];
 $j=$j+2;
 $k=$k+2;
 }
   }
   return $res;
   }
 ?




 From: Jason Wong [EMAIL PROTECTED]

 To: [EMAIL PROTECTED]
 Subject: Re: [PHP]  Desperate!!!   Resource id #24 -
 error???
 Date: Sat, 23 Mar 2002 02:18:58 +0800
 
 On Saturday 23 March 2002 01:53, brendan conroy wrote:
   Hi guys,
   Thanks for reading this. I desperatley need help with this
 
 error. I
 
   just finished a huge project thats taken me months, my code works, but
 
 the
 
   code its attached to has an error. The project is due Monday and
 
 naturally
 
   enough the guy who wrote the code with the error is gone on holiday for
 
 the
 
   weekend- typical.
 
 Let's see the code that its attached to.
 
 
 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 
 /*
 Slang is language that takes off its coat, spits on its hands, and goes to
 work.
 */
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 _
 MSN Photos is the easiest way to share and print your photos:
 http://photos.msn.com/support/worldwide.aspx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php