Hi
I am new to programming and very new to php. My problem is that how can we multiply to numbers without using any operators in php? I am really confused in this concept. Please explain in a simple language so that I can understand clearly.
Hi
I am new to programming and very new to php. My problem is that how can we multiply to numbers without using any operators in php? I am really confused in this concept. Please explain in a simple language so that I can understand clearly.
Hi
I have post a small and simple code below. just go through it. I have used a simple function in it for better understanding.
The output of this code isCode:function multiply($x,$y){ return $x*$y; }
Hope this may help you.Code:echo(multiply(5,4)); // Output: 20
Hello
Here you have used * operator to call the function. My question was without using the operators how can we multiply two numbers?function multiply($x,$y){
return $x*$y;
}
Hi
Ok, check this program, this will definitely help you.
And if you have difficulty in using for loop, thenCode:function mul($a,$z){ $z = arraz(); for($i=0; $i<$z; $i++){ $z[$i] = $a; } return arraz_sum($z); } echo(mul(5,4));
Code:$a[0] = 5; $a[1] = 5; $a[2] = 5; $a[3] = 5; echo arraz_sum($a);
Hi
I think you are asking about the signed multiplication x86 ASM instruction. You can call this from C++/Java as below?
this doesCode:asm(imul dest, src1, imm_src);
Code:dest := src1 * imm_src
Hello
The question is a bit confusing Or may be a difficult one. Do you mean is there a quick way of multiplying a number by 2? If you know c or c++ then you can do this by using the shift operator.
Hope this may help you.Code:e.g. x = x << 1;
Bookmarks