commit 0e9cf0e6de88fcb4ea9d72fcd777103696ae4691 Author: H1K0 Date: Sat Sep 26 14:37:23 2020 +0300 Initial commit I like to start new repos with this phrase: Let's get it started! diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/README.md b/README.md new file mode 100644 index 0000000..784659b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# PersonalHomeCalc ![PHP | WEB](https://img.shields.io/badge/WEB-PHP-blue.svg) + + A simple but cute calc on PHP :3 \ No newline at end of file diff --git a/calc.php b/calc.php new file mode 100644 index 0000000..a0713ea --- /dev/null +++ b/calc.php @@ -0,0 +1,30 @@ +'1','result'=>(int)$number1+(int)$number2]; + } else if ($oper == "-") { + $res=['rcode'=>'1','result'=>(int)$number1-(int)$number2]; + } else if ($oper=="*") { + $res=['rcode'=>'1','result'=>(int)$number1*(int)$number2]; + } else if ($oper=="/") { + if ((int)$number2 == 0) { + $res=['rcode'=>'0','result'=>"division by zero"]; + } else { + $res=['rcode'=>'1','result'=>(int)$number1/(int)$number2]; + } + } else { + $res=['rcode'=>'0','result'=>"unknown operation"]; + } + $data=$res; + header('Content-type: application/json'); + echo json_encode($data); +?> \ No newline at end of file diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..4fedb59 Binary files /dev/null and b/favicon.png differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..95e0dd1 --- /dev/null +++ b/index.php @@ -0,0 +1,197 @@ + +
+ + + + + + Personal Home Calc + + + + + + +
0
+
+ +
+
+ +
+
+ +
+
+ +
+ +