$element[0] = "-".$element[0]; $element[1] = "-".$element[1]; $element[2] = "-".$element[2]; $element[3] = "-".$element[3];
-----Original Message----- From: brendan conroy [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 3:03 PM To: [EMAIL PROTECTED] Subject: [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;$cnt<count($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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php