Jump to content

Very simple adding not working !


duckstar

Recommended Posts

uhhmm

This displays the correct values:

<?php
$temp1=9;
$temp2=4;
//$temp1 = $nonRBProducts[$counteri][3];
$temp1 * 1;
//$temp2 = $RBProducts[$counterr][3];
$temp2 *  1;
$temp3 = $temp1 + $temp2;

echo"temp1 = $temp1<br />temp2 = $temp2<br />temp3 = $temp3<br />";
?>

 

Are you sure the variables $nonRBProducts[$counteri][3]; and $RBProducts[$counterr][3]; contain a value?

 

And what is the purpose of attempting to multiplying by 1? If that's what you want to do because $temp2 *  1; wont do anything!

Well first of all, what are you doing in the commented lines below?

 

		
$temp1 = $nonRBProducts[$counteri][3];
$temp1 * 1; ///<--- What are you doing here?  This won't result in the value of $temp1 changing in any way.
$temp2 = $RBProducts[$counterr][3];
$temp2 * 1; ///<--- And here?
$temp3 = $temp1 + $temp2;

Thanks for the replys

die($nonRBProducts[$counteri][3]);

Returns 9

die($RBProducts[$counterr][3]);

Returns 4

 

$temp2 * 1;

I know this doesn't change the value.  I did this to try and force PHP to see it as a INT so that it would add correctly on the next line.

 

die($temp1."+".$temp2."=".$temp3);

Now returns = "9+4=13"

 

but

		$temp1 = $nonRBProducts[$counteri][3];
		$temp1 * 1;
		$temp2 = $RBProducts[$counterr][3];
		$temp2 * 1;
		$temp3 = $temp1 + $temp2;
		//die($temp1."+".$temp2."=".$temp3);
		$mergedAdviceNotes[$mergedIndex][3] = $temp3;
		die($mergedAdviceNotes[$mergedIndex][3]);

This returns nothing...

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.