How to generate random operator after each random operand using php?
Here is my code for random operand generator:
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$randomOperands = rand(0, 9);
}
// print array values:
foreach($randomOperands as $key=>$value1){
echo $value1 "<br />";
}
But how can I generate random operator just after each random operand?
This is my form through which user will give his input and the n no.of questions having random sequence containing n(no.of operands user wants, he can give input for this within the range of 1 to 10 ) operands and n-1 operators and answer of the sequence will be generated after clicking on generate button.
<form action="" method="POST">
Select no.of questions:<input type="number" name="que" value="que">
<br>
<br>
Select no. of series: <select name="select">
<option value="0"> 2 </option>
<option value="1"> 3 </option>
<option value="2"> 4 </option>
<option value="3"> 5 </option>
<option value="4"> 6 </option>
<option value="5"> 7 </option>
<option value="6"> 8 </option>
<option value="7"> 9 </option>
<option value="8"> 10 </option>
</select>
<br><br>
Select number type(in digits) :
<select name="select_box">
<option value="0">1</option>
<option value="1"> 2 </option>
<option value="2"> 3 </option>
<br><br>
</select>
<br /><br />
Select operations:<br />
<input type="checkbox" id="add" name="operation" value="addition"
onclick="doOperation()"><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="subtract"
onclick="doOperation()"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="multiply"
onclick="doOperation()"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="divide"
onclick="doOperation()"><label>Division</label>
<br><br>
<br><br>
<input type="submit" name="submit" value="Generate"><br>
<br>
</form>
here in the form 1st field is no.of questions i.e how many questions user wants to get having random sequence.
2nd field is no. of series i.e how many operands user wants in that sequence (if he gave input for 6 or any number between 1 to 10 then the sequence of 6 operands and 5 operators and their ans. will be generated at the end after filling all fields).
3rd field is no. of digits i.e for how many digits user wnat to generate a sequence, I have given choces only upto 3 digits.
at last, which operations user want to perform for sequence
I know its very tricky task but interseting too.
how can I do it?
javascript php html
add a comment |
Here is my code for random operand generator:
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$randomOperands = rand(0, 9);
}
// print array values:
foreach($randomOperands as $key=>$value1){
echo $value1 "<br />";
}
But how can I generate random operator just after each random operand?
This is my form through which user will give his input and the n no.of questions having random sequence containing n(no.of operands user wants, he can give input for this within the range of 1 to 10 ) operands and n-1 operators and answer of the sequence will be generated after clicking on generate button.
<form action="" method="POST">
Select no.of questions:<input type="number" name="que" value="que">
<br>
<br>
Select no. of series: <select name="select">
<option value="0"> 2 </option>
<option value="1"> 3 </option>
<option value="2"> 4 </option>
<option value="3"> 5 </option>
<option value="4"> 6 </option>
<option value="5"> 7 </option>
<option value="6"> 8 </option>
<option value="7"> 9 </option>
<option value="8"> 10 </option>
</select>
<br><br>
Select number type(in digits) :
<select name="select_box">
<option value="0">1</option>
<option value="1"> 2 </option>
<option value="2"> 3 </option>
<br><br>
</select>
<br /><br />
Select operations:<br />
<input type="checkbox" id="add" name="operation" value="addition"
onclick="doOperation()"><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="subtract"
onclick="doOperation()"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="multiply"
onclick="doOperation()"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="divide"
onclick="doOperation()"><label>Division</label>
<br><br>
<br><br>
<input type="submit" name="submit" value="Generate"><br>
<br>
</form>
here in the form 1st field is no.of questions i.e how many questions user wants to get having random sequence.
2nd field is no. of series i.e how many operands user wants in that sequence (if he gave input for 6 or any number between 1 to 10 then the sequence of 6 operands and 5 operators and their ans. will be generated at the end after filling all fields).
3rd field is no. of digits i.e for how many digits user wnat to generate a sequence, I have given choces only upto 3 digits.
at last, which operations user want to perform for sequence
I know its very tricky task but interseting too.
how can I do it?
javascript php html
Do you just want to print, or do you also want to calculate? If you want to calculate, what operator precedence do you want? Scientific or immediate?
– Ben Hillier
Nov 15 '18 at 7:43
add a comment |
Here is my code for random operand generator:
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$randomOperands = rand(0, 9);
}
// print array values:
foreach($randomOperands as $key=>$value1){
echo $value1 "<br />";
}
But how can I generate random operator just after each random operand?
This is my form through which user will give his input and the n no.of questions having random sequence containing n(no.of operands user wants, he can give input for this within the range of 1 to 10 ) operands and n-1 operators and answer of the sequence will be generated after clicking on generate button.
<form action="" method="POST">
Select no.of questions:<input type="number" name="que" value="que">
<br>
<br>
Select no. of series: <select name="select">
<option value="0"> 2 </option>
<option value="1"> 3 </option>
<option value="2"> 4 </option>
<option value="3"> 5 </option>
<option value="4"> 6 </option>
<option value="5"> 7 </option>
<option value="6"> 8 </option>
<option value="7"> 9 </option>
<option value="8"> 10 </option>
</select>
<br><br>
Select number type(in digits) :
<select name="select_box">
<option value="0">1</option>
<option value="1"> 2 </option>
<option value="2"> 3 </option>
<br><br>
</select>
<br /><br />
Select operations:<br />
<input type="checkbox" id="add" name="operation" value="addition"
onclick="doOperation()"><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="subtract"
onclick="doOperation()"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="multiply"
onclick="doOperation()"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="divide"
onclick="doOperation()"><label>Division</label>
<br><br>
<br><br>
<input type="submit" name="submit" value="Generate"><br>
<br>
</form>
here in the form 1st field is no.of questions i.e how many questions user wants to get having random sequence.
2nd field is no. of series i.e how many operands user wants in that sequence (if he gave input for 6 or any number between 1 to 10 then the sequence of 6 operands and 5 operators and their ans. will be generated at the end after filling all fields).
3rd field is no. of digits i.e for how many digits user wnat to generate a sequence, I have given choces only upto 3 digits.
at last, which operations user want to perform for sequence
I know its very tricky task but interseting too.
how can I do it?
javascript php html
Here is my code for random operand generator:
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$randomOperands = rand(0, 9);
}
// print array values:
foreach($randomOperands as $key=>$value1){
echo $value1 "<br />";
}
But how can I generate random operator just after each random operand?
This is my form through which user will give his input and the n no.of questions having random sequence containing n(no.of operands user wants, he can give input for this within the range of 1 to 10 ) operands and n-1 operators and answer of the sequence will be generated after clicking on generate button.
<form action="" method="POST">
Select no.of questions:<input type="number" name="que" value="que">
<br>
<br>
Select no. of series: <select name="select">
<option value="0"> 2 </option>
<option value="1"> 3 </option>
<option value="2"> 4 </option>
<option value="3"> 5 </option>
<option value="4"> 6 </option>
<option value="5"> 7 </option>
<option value="6"> 8 </option>
<option value="7"> 9 </option>
<option value="8"> 10 </option>
</select>
<br><br>
Select number type(in digits) :
<select name="select_box">
<option value="0">1</option>
<option value="1"> 2 </option>
<option value="2"> 3 </option>
<br><br>
</select>
<br /><br />
Select operations:<br />
<input type="checkbox" id="add" name="operation" value="addition"
onclick="doOperation()"><label>Addition</label>
<input type="checkbox" id="sub" name="operation" value="subtract"
onclick="doOperation()"><label>Subtraction</label>
<input type="checkbox" id="mult" name="operation" value="multiply"
onclick="doOperation()"><label>Multiplication</label>
<input type="checkbox" id="div" name="operation" value="divide"
onclick="doOperation()"><label>Division</label>
<br><br>
<br><br>
<input type="submit" name="submit" value="Generate"><br>
<br>
</form>
here in the form 1st field is no.of questions i.e how many questions user wants to get having random sequence.
2nd field is no. of series i.e how many operands user wants in that sequence (if he gave input for 6 or any number between 1 to 10 then the sequence of 6 operands and 5 operators and their ans. will be generated at the end after filling all fields).
3rd field is no. of digits i.e for how many digits user wnat to generate a sequence, I have given choces only upto 3 digits.
at last, which operations user want to perform for sequence
I know its very tricky task but interseting too.
how can I do it?
javascript php html
javascript php html
edited Nov 15 '18 at 9:51
user10625430
asked Nov 15 '18 at 7:21
user10625430user10625430
507
507
Do you just want to print, or do you also want to calculate? If you want to calculate, what operator precedence do you want? Scientific or immediate?
– Ben Hillier
Nov 15 '18 at 7:43
add a comment |
Do you just want to print, or do you also want to calculate? If you want to calculate, what operator precedence do you want? Scientific or immediate?
– Ben Hillier
Nov 15 '18 at 7:43
Do you just want to print, or do you also want to calculate? If you want to calculate, what operator precedence do you want? Scientific or immediate?
– Ben Hillier
Nov 15 '18 at 7:43
Do you just want to print, or do you also want to calculate? If you want to calculate, what operator precedence do you want? Scientific or immediate?
– Ben Hillier
Nov 15 '18 at 7:43
add a comment |
1 Answer
1
active
oldest
votes
Here's how I would generate a string of integers and operands.
Note how extra checks are needed to avoid division by zero.
Also, as asked above, do you actually want to evaluate the results in code?
<?php
$potentialOperands = array('+', '-', '*', '/'); //Keep division as the last operand here
$previousInt = null; //Track the previous operand, else we'll get division by zero
$randomIntegers = array();
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$nextInt = rand(0, 9);
$randomIntegers = $nextInt;
if($i < 10){ //No operand after last integer
if($previousInt === 0){
//Make sure to avoid a potenial division-by-zero
$randomOperands = $potentialOperands[rand(0, 2)];
}
else{
$randomOperands = $potentialOperands[rand(0, 3)];
}
}
$previousInt = $nextInt;
}
// print array values:
$exp = '';
foreach($randomIntegers as $key=>$value1)
{
$exp .= $value1 . " ";
if(isset($randomOperands[$key])){
$exp .= $randomOperands[$key] ." ";
}
}
$res = eval("return ($exp);");
//Generates answer rounded to 3 decimal places
//The answer uses standard PHP operator precedence
printf("%s = %.3f", $exp, $res);
?>
Hey thanks a lot for the reply and yes I want to generate the result too in the output along with the expression , how can I generate that whole expression?
– user10625430
Nov 15 '18 at 8:11
I've updated my answer accordingly.
– Ben Hillier
Nov 15 '18 at 8:19
Be aware that there are several open questions here, such as operator precedence; and when and where to round of division results.
– Ben Hillier
Nov 15 '18 at 8:25
Thanks a lot its working ..! Actually , I shoulld have specified it early that the sequence will be randomly generated so operator precednce , actually doesn't matter here .and the output will be depend on input given by the user through a form that I have created.
– user10625430
Nov 15 '18 at 9:18
hey ben , your answer is really helpful, thanks a lot for that . bu I nedd another help, I have updated the question can you please go through it and give me some suggestion? That would be great.
– user10625430
Nov 15 '18 at 9:54
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314264%2fhow-to-generate-random-operator-after-each-random-operand-using-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here's how I would generate a string of integers and operands.
Note how extra checks are needed to avoid division by zero.
Also, as asked above, do you actually want to evaluate the results in code?
<?php
$potentialOperands = array('+', '-', '*', '/'); //Keep division as the last operand here
$previousInt = null; //Track the previous operand, else we'll get division by zero
$randomIntegers = array();
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$nextInt = rand(0, 9);
$randomIntegers = $nextInt;
if($i < 10){ //No operand after last integer
if($previousInt === 0){
//Make sure to avoid a potenial division-by-zero
$randomOperands = $potentialOperands[rand(0, 2)];
}
else{
$randomOperands = $potentialOperands[rand(0, 3)];
}
}
$previousInt = $nextInt;
}
// print array values:
$exp = '';
foreach($randomIntegers as $key=>$value1)
{
$exp .= $value1 . " ";
if(isset($randomOperands[$key])){
$exp .= $randomOperands[$key] ." ";
}
}
$res = eval("return ($exp);");
//Generates answer rounded to 3 decimal places
//The answer uses standard PHP operator precedence
printf("%s = %.3f", $exp, $res);
?>
Hey thanks a lot for the reply and yes I want to generate the result too in the output along with the expression , how can I generate that whole expression?
– user10625430
Nov 15 '18 at 8:11
I've updated my answer accordingly.
– Ben Hillier
Nov 15 '18 at 8:19
Be aware that there are several open questions here, such as operator precedence; and when and where to round of division results.
– Ben Hillier
Nov 15 '18 at 8:25
Thanks a lot its working ..! Actually , I shoulld have specified it early that the sequence will be randomly generated so operator precednce , actually doesn't matter here .and the output will be depend on input given by the user through a form that I have created.
– user10625430
Nov 15 '18 at 9:18
hey ben , your answer is really helpful, thanks a lot for that . bu I nedd another help, I have updated the question can you please go through it and give me some suggestion? That would be great.
– user10625430
Nov 15 '18 at 9:54
add a comment |
Here's how I would generate a string of integers and operands.
Note how extra checks are needed to avoid division by zero.
Also, as asked above, do you actually want to evaluate the results in code?
<?php
$potentialOperands = array('+', '-', '*', '/'); //Keep division as the last operand here
$previousInt = null; //Track the previous operand, else we'll get division by zero
$randomIntegers = array();
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$nextInt = rand(0, 9);
$randomIntegers = $nextInt;
if($i < 10){ //No operand after last integer
if($previousInt === 0){
//Make sure to avoid a potenial division-by-zero
$randomOperands = $potentialOperands[rand(0, 2)];
}
else{
$randomOperands = $potentialOperands[rand(0, 3)];
}
}
$previousInt = $nextInt;
}
// print array values:
$exp = '';
foreach($randomIntegers as $key=>$value1)
{
$exp .= $value1 . " ";
if(isset($randomOperands[$key])){
$exp .= $randomOperands[$key] ." ";
}
}
$res = eval("return ($exp);");
//Generates answer rounded to 3 decimal places
//The answer uses standard PHP operator precedence
printf("%s = %.3f", $exp, $res);
?>
Hey thanks a lot for the reply and yes I want to generate the result too in the output along with the expression , how can I generate that whole expression?
– user10625430
Nov 15 '18 at 8:11
I've updated my answer accordingly.
– Ben Hillier
Nov 15 '18 at 8:19
Be aware that there are several open questions here, such as operator precedence; and when and where to round of division results.
– Ben Hillier
Nov 15 '18 at 8:25
Thanks a lot its working ..! Actually , I shoulld have specified it early that the sequence will be randomly generated so operator precednce , actually doesn't matter here .and the output will be depend on input given by the user through a form that I have created.
– user10625430
Nov 15 '18 at 9:18
hey ben , your answer is really helpful, thanks a lot for that . bu I nedd another help, I have updated the question can you please go through it and give me some suggestion? That would be great.
– user10625430
Nov 15 '18 at 9:54
add a comment |
Here's how I would generate a string of integers and operands.
Note how extra checks are needed to avoid division by zero.
Also, as asked above, do you actually want to evaluate the results in code?
<?php
$potentialOperands = array('+', '-', '*', '/'); //Keep division as the last operand here
$previousInt = null; //Track the previous operand, else we'll get division by zero
$randomIntegers = array();
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$nextInt = rand(0, 9);
$randomIntegers = $nextInt;
if($i < 10){ //No operand after last integer
if($previousInt === 0){
//Make sure to avoid a potenial division-by-zero
$randomOperands = $potentialOperands[rand(0, 2)];
}
else{
$randomOperands = $potentialOperands[rand(0, 3)];
}
}
$previousInt = $nextInt;
}
// print array values:
$exp = '';
foreach($randomIntegers as $key=>$value1)
{
$exp .= $value1 . " ";
if(isset($randomOperands[$key])){
$exp .= $randomOperands[$key] ." ";
}
}
$res = eval("return ($exp);");
//Generates answer rounded to 3 decimal places
//The answer uses standard PHP operator precedence
printf("%s = %.3f", $exp, $res);
?>
Here's how I would generate a string of integers and operands.
Note how extra checks are needed to avoid division by zero.
Also, as asked above, do you actually want to evaluate the results in code?
<?php
$potentialOperands = array('+', '-', '*', '/'); //Keep division as the last operand here
$previousInt = null; //Track the previous operand, else we'll get division by zero
$randomIntegers = array();
$randomOperands = array();
// do a loop over $i n times
for ($i = 0; $i <= 10; $i ++) {
// assign random operand to array slot
$nextInt = rand(0, 9);
$randomIntegers = $nextInt;
if($i < 10){ //No operand after last integer
if($previousInt === 0){
//Make sure to avoid a potenial division-by-zero
$randomOperands = $potentialOperands[rand(0, 2)];
}
else{
$randomOperands = $potentialOperands[rand(0, 3)];
}
}
$previousInt = $nextInt;
}
// print array values:
$exp = '';
foreach($randomIntegers as $key=>$value1)
{
$exp .= $value1 . " ";
if(isset($randomOperands[$key])){
$exp .= $randomOperands[$key] ." ";
}
}
$res = eval("return ($exp);");
//Generates answer rounded to 3 decimal places
//The answer uses standard PHP operator precedence
printf("%s = %.3f", $exp, $res);
?>
edited Nov 15 '18 at 8:17
answered Nov 15 '18 at 8:00
Ben HillierBen Hillier
1,7331610
1,7331610
Hey thanks a lot for the reply and yes I want to generate the result too in the output along with the expression , how can I generate that whole expression?
– user10625430
Nov 15 '18 at 8:11
I've updated my answer accordingly.
– Ben Hillier
Nov 15 '18 at 8:19
Be aware that there are several open questions here, such as operator precedence; and when and where to round of division results.
– Ben Hillier
Nov 15 '18 at 8:25
Thanks a lot its working ..! Actually , I shoulld have specified it early that the sequence will be randomly generated so operator precednce , actually doesn't matter here .and the output will be depend on input given by the user through a form that I have created.
– user10625430
Nov 15 '18 at 9:18
hey ben , your answer is really helpful, thanks a lot for that . bu I nedd another help, I have updated the question can you please go through it and give me some suggestion? That would be great.
– user10625430
Nov 15 '18 at 9:54
add a comment |
Hey thanks a lot for the reply and yes I want to generate the result too in the output along with the expression , how can I generate that whole expression?
– user10625430
Nov 15 '18 at 8:11
I've updated my answer accordingly.
– Ben Hillier
Nov 15 '18 at 8:19
Be aware that there are several open questions here, such as operator precedence; and when and where to round of division results.
– Ben Hillier
Nov 15 '18 at 8:25
Thanks a lot its working ..! Actually , I shoulld have specified it early that the sequence will be randomly generated so operator precednce , actually doesn't matter here .and the output will be depend on input given by the user through a form that I have created.
– user10625430
Nov 15 '18 at 9:18
hey ben , your answer is really helpful, thanks a lot for that . bu I nedd another help, I have updated the question can you please go through it and give me some suggestion? That would be great.
– user10625430
Nov 15 '18 at 9:54
Hey thanks a lot for the reply and yes I want to generate the result too in the output along with the expression , how can I generate that whole expression?
– user10625430
Nov 15 '18 at 8:11
Hey thanks a lot for the reply and yes I want to generate the result too in the output along with the expression , how can I generate that whole expression?
– user10625430
Nov 15 '18 at 8:11
I've updated my answer accordingly.
– Ben Hillier
Nov 15 '18 at 8:19
I've updated my answer accordingly.
– Ben Hillier
Nov 15 '18 at 8:19
Be aware that there are several open questions here, such as operator precedence; and when and where to round of division results.
– Ben Hillier
Nov 15 '18 at 8:25
Be aware that there are several open questions here, such as operator precedence; and when and where to round of division results.
– Ben Hillier
Nov 15 '18 at 8:25
Thanks a lot its working ..! Actually , I shoulld have specified it early that the sequence will be randomly generated so operator precednce , actually doesn't matter here .and the output will be depend on input given by the user through a form that I have created.
– user10625430
Nov 15 '18 at 9:18
Thanks a lot its working ..! Actually , I shoulld have specified it early that the sequence will be randomly generated so operator precednce , actually doesn't matter here .and the output will be depend on input given by the user through a form that I have created.
– user10625430
Nov 15 '18 at 9:18
hey ben , your answer is really helpful, thanks a lot for that . bu I nedd another help, I have updated the question can you please go through it and give me some suggestion? That would be great.
– user10625430
Nov 15 '18 at 9:54
hey ben , your answer is really helpful, thanks a lot for that . bu I nedd another help, I have updated the question can you please go through it and give me some suggestion? That would be great.
– user10625430
Nov 15 '18 at 9:54
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314264%2fhow-to-generate-random-operator-after-each-random-operand-using-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you just want to print, or do you also want to calculate? If you want to calculate, what operator precedence do you want? Scientific or immediate?
– Ben Hillier
Nov 15 '18 at 7:43