[PHP] Desperate!!!!!!! Resource id #24 - error???????????
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 worlds 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
[PHP] Sooo close - please help
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 it uses 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. To be so close to having it finished is sort of sickening.. 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. Heres the other guys code, Im pretty sure the bug is in monic or prodmono as they're the functions that deal with the elements that are turned into Resource id #'s . I know this is an awful lot to ask,but like I said Im desperate ? 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; } ? I'd really appreciate help with this Thanks a million _ Join the worlds 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
[PHP] Novice question
Hi, thanks for reading this, Im just going to say it cos i dont want to waste your time. Im looking for a really big favour here(cos I think it may take time to spot this, although it might only take five seconds to spot, but I dunno,the problem area of code is only four lines long), so dont spend time reading this unless you got half an hour spare or are looking a good samaritan award or something. Still reading this? Excellent, Iam saved. I wrote code which takes a input string, breaks it up and puts the bits into an array called $real. THIS WORKS. But I may have lots of input strings so I slapped a for loop around the code to do the same thing for all the inputs and THAT WORKS ASWELL! Then i wanted to save the different bits of each input string in its own array, so I created an array of arrays and at the end of each cycle of the big loop, I take out all the element in $real and put them into the array of arrays, called $poly[][]. THIS DOESNT WORK. I've spent a week trying to fix this and get that horrible feeling that all the work is going down the drain, cos if I dont get this working, I am screwed. I'd be sincerely grateful if someone could help me with this /*===*/ I put these type of comments around the problem area of the code, which is about four lines long near the bottom /*===*/ Regards Bren html body ? print_r($poly); echoHR; $real[0]=0; $z=array_pop($real); $array[0] = 0; $z = array_pop($array); /*$real[0] = 0; $z = array_pop($real);*/ $test[0]=0; $z = array_pop($test); /*big loop=*/ for($ws=0;$wscount($poly);$ws++) { $rt=0; $c = explode(+, $poly[$ws]); /*echoC EQUALS.BR.*/ /*echoshit; print_r($c);*/ for($r=0;$r=count($c);$r++) { /* echopeaches; echoHR;*/ $m=$c[$r]; echoM EQUALS.BR; echo$m; echoBR; $count=0; for($j=0;$jstrlen($m);$j++) { /* echopurple;*/ /* echo$c[$r];*/ echoBR; /*$count=0;*/ if($m[$j]==- ) { $count++; } } if((($m[0]==-)AND($count2))OR($count1)) { echodumbass; echoBR; /*if(count($real)=4)*/ { array_push($real,$c[$r]); echoBR; } } elseif(($m[0]==-)AND($count1)) { echobla; echoBR; $ss = explode(-,$m); for($cnt=0;$cntcount($ss);$cnt++) { echosweetness; echoBR; $ss[$cnt] = -.$ss[$cnt]; for($waa=0;$waacount($c);$waa++) { array_push($real,$ss[$cnt]); } } } else { echowaaweaaawaaaweaaa; echoBR; $ss = explode(-,$m); for($na=1;$nacount($ss);$na++) { $ss[$na] = -.$ss[$na]; } for($la=0;$la=count($c);$la++) { array_push($real,$ss[$la]); echoBR; } } /*echo$count; echoreal; echoBR; print_r($real); */ } /* for($rt=0;$rtcount($real);$rt++) */ /*=heres the problem==*/ while(count($real)0) { print_r($real); echoBR; $poly[$ws][$rt]=array_pop($real); $rt++; echopink elephants; /**/ } } /*end of big loop*/ echoreal; echoBR; print_r($real); echoHR.POLY EQUALS; for($ty=0;$ty4/*count($poly[$ws][$rt])*/;$ty++) { echoHR.print loop; echo $poly[0][$ty]; echoHR; } echoHR; ? /body /html _ Join the worlds 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
[PHP] novice question -- array_push($real[$i][$j],$s[$j]);????????
Hi, thanks for reading this, Iam trying to push elements into a two dimentional array, but I cant find the proper syntax, I'd be grateful if someone could email me the proper method. Iam using the normal method, which worked fine for a one dimentional array, but when I use it for a two dimentional array, it doesnt seem to recognise that is an array, even though I initialized the array with $real[0][0] = 0;. Thanks a million for your time, Bren _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Novice Question
Hi thanks for reading this. This problem is difficult to get across, this is what happens: A) On a html page I ask users how many inputs they wish to enter, say 3. The 3 is stored as a variable called $NoPols. B) Then in the code below, a loop creates $NoPols (3) forms to take the users inputs. The problem is that the same name($Yourpol) is used in each of the created forms, and i dont know how to get around this problem. I would like to know if it is possible to create a page which has a number of forms, the number of which is decided by the user(on a start page), so the user can submit as many inputs as they want from one page. Sorry if I've wasted your time, I'd be very grateful for any assisstance with this problem, thanks a million, Brendan html head titlenpage.php/title /head body bgcolor=#FF text=#00 p ?php $NoPols; ? ?php for($i=1 ;$i= $NoPols ; $i++) { ? form action=ppage.php method=post enter polynomial ? echo $i;? here:input type=text name=Yourpol br /br ? } ? input type=submit name=submit value=Submit Pols! /body /html _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Novice question
Hi,thanks for reading this! This problem has got me beat! I cant figure out how to insert a minus sign into each element in an array of strings. I keep getting the error that the first element in array_push has to be an array, no matter what method I've tried, and I cant think of any more! Im trying to isolate terms in polynommials, which Ive stored in an array m[] like this: $m[0]=-3x_1^6/7-4x_2^3/5; $m[1]=-4x_3^2/3-7x_4/7; /*Each element in m has two terms, and I want to isolate these by exploding on the minus sign, thus giving me four elements, which then need to have a minus inserted into them. I take one of the four elements in $ss, and for each character I push it into a temporary storage array $test, then I reverse $test so the term is in the correct order, and then I insert the minus sign at the start. But funnily enough, there seems to be a flaw in my logic or code. What Ive written so far is*/ $ss=explode(-,$m); for($cnt=1;$cntcount($ss);$cnt++) { for($waa=0;$waa$cnt;$c++) { array_push($test,$ss[$waa]) } array_reverse($test); array_push($test,-); array_push($real,$test); I would be extremely grateful for anyones assistance, thanks a million, Regards Bren _ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] VERY novice question!
Thanks for reading this! This is a really novice question but I cant find any info about this in the online manual. I would be grateful if someone could email me the PHP equivalent of the (AND) and ||(OR) operators which are used in C. I'am trying to write if statements like if((($m[0]==-)($count2))||($count++0)) { } I be grateful for any replies!! Thanks, Bren _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert a string to an array w/o spliting or exploding
Hi, thanks for reading this novice question, I'd be grateful if someone could email me and tell me if its possible to convert a string to an array whithout using the split[] or explode[] function, as these aren't appropriate for the task. I cant find any ino on php.net, Thanks, Bren _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Novice question - Please Help
Hi, thanks for reading this. Ive looked at every php site and cant find an answer, youre my last hope!(ok so its not that serious, but pretty close!). Could someone please email me and tell me how to split a string into different arrays and save what they were split on? Also I cant get the sizeof function to work no matter what syntax i use, i think ive tried them all, do you have to include a library or something in your program to make it work? Thanks a million, this isint a frivilous question, I looked everywhere before i came here, thanks, Bren _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]