NOTE! This website and the forum are pretty much in archival mode and are often prone to being broken.
If you need something or would like to reconnect with the community reach out to Monkeydog on Discord (username Monkeydog189).
Simple PHP calculator - Grove of Game Making and General Programming - Monkey Productions

Jump to content


Photo
- - - - -

Simple PHP calculator


  • Please log in to reply
16 replies to this topic

#1 Billy

Billy

    Okie dokie lokie...

  • Members
  • 551 posts
  • Location:Colorado, USA
  • Interests:also cocks
  • Gender:Male

Posted 25 March 2008 - 08:43 PM

So I got bored and... here.

Also, divide by zero, I dare ya.
  • 0
Posted Image
Come visit RotW, we have free candy~

#2 SAGE

SAGE

    Master Sage

  • Members
  • 233 posts
  • Location:Clearwater, Florida
  • Gender:Male

Posted 19 April 2008 - 05:07 PM

OSHI- ......?
  • 0
Posted Image


FA-Q

Thats right. I said it. How you like me now?!?!?
Hyperlisk was here

#3 matrim

matrim

    Killer Coder Ninja Monkey

  • Members
  • 478 posts
  • Location:Sweden
  • Gender:Male

Posted 22 April 2008 - 02:50 AM

simple.
Version 1.1 should be without the waiting post between, make it read the intire command line then sybstring or explode it and let it do a full calc in the end, Im dare you to do that :P
  • 0

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Yes private, thats exactly it. War's over, we won.
Turns out you're the big hero and we're gonna hold a parade in your honor.
I get to drive the float, and Simmons here IS IN CHARGE OF CONFETTI!!!
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_


#4 Billy

Billy

    Okie dokie lokie...

  • Members
  • 551 posts
  • Location:Colorado, USA
  • Interests:also cocks
  • Gender:Male

Posted 22 April 2008 - 03:53 PM

I've actually been working on that, but it's too damn hard getting it to work with more then one operator. =\
  • 0
Posted Image
Come visit RotW, we have free candy~

#5 Hyperlisk

Hyperlisk

    Meow.

  • StarCraft
  • 3895 posts
  • Location:The Land Unknown
  • Gender:Male

Posted 22 April 2008 - 03:57 PM

You could use eval(); Just make sure you filter out everything that shouldn't be in a math expression.
  • 0
TIP.png

#6 Billy

Billy

    Okie dokie lokie...

  • Members
  • 551 posts
  • Location:Colorado, USA
  • Interests:also cocks
  • Gender:Male

Posted 22 April 2008 - 04:32 PM

You could use eval(); Just make sure you filter out everything that shouldn't be in a math expression.

I can't seem to get that working with user input.
eval("\$answer = 1+1;");
Works fine, but
$str = "\"\\\$answer =".$_POST["value"].";\"";
eval($str);
doesn't, when I enter "1+1"
  • 0
Posted Image
Come visit RotW, we have free candy~

#7 Hyperlisk

Hyperlisk

    Meow.

  • StarCraft
  • 3895 posts
  • Location:The Land Unknown
  • Gender:Male

Posted 22 April 2008 - 05:04 PM

<?php



$str = "THIS IS NOT VALID MATH STUFFZ 1+1+(2*3) ALSO NOT VALID MATH STUFFZ";

$str = preg_replace('/[^0-9-\/\*\+\(\)]*/','',$str);

$ret = eval('return ('.$str.');');

var_dump($ret);



?>

  • 0
TIP.png

#8 Billy

Billy

    Okie dokie lokie...

  • Members
  • 551 posts
  • Location:Colorado, USA
  • Interests:also cocks
  • Gender:Male

Posted 22 April 2008 - 05:58 PM

I tip my hat to you.

Though, it's not like this is really a major or important project. Thanks all the same.
  • 0
Posted Image
Come visit RotW, we have free candy~

#9 Hyperlisk

Hyperlisk

    Meow.

  • StarCraft
  • 3895 posts
  • Location:The Land Unknown
  • Gender:Male

Posted 22 April 2008 - 07:00 PM

No problem. If you need any other PHP help, ask me :P
  • 0
TIP.png

#10 Stars

Stars

    King Koopa

  • Members
  • 970 posts
  • Location:Canadaland
  • Interests:This list comprises 80% of DOS, Antha, food and drinks. The rest is unimportant by comparison.
  • Gender:Male

Posted 22 April 2008 - 10:19 PM

It doesn't go O SHI- anymore.

Do not want.
  • 0
Posted Image

#11 Billy

Billy

    Okie dokie lokie...

  • Members
  • 551 posts
  • Location:Colorado, USA
  • Interests:also cocks
  • Gender:Male

Posted 23 April 2008 - 09:16 AM

Okay, fixed it to OSHI- again. =P
  • 0
Posted Image
Come visit RotW, we have free candy~

#12 Stars

Stars

    King Koopa

  • Members
  • 970 posts
  • Location:Canadaland
  • Interests:This list comprises 80% of DOS, Antha, food and drinks. The rest is unimportant by comparison.
  • Gender:Male

Posted 23 April 2008 - 09:54 AM

Yay! =D
  • 0
Posted Image

#13 matrim

matrim

    Killer Coder Ninja Monkey

  • Members
  • 478 posts
  • Location:Sweden
  • Gender:Male

Posted 24 April 2008 - 12:38 AM

PHP is the shit!!!!!!!
  • 0

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Yes private, thats exactly it. War's over, we won.
Turns out you're the big hero and we're gonna hold a parade in your honor.
I get to drive the float, and Simmons here IS IN CHARGE OF CONFETTI!!!
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_


#14 Guest_viky_*

Guest_viky_*
  • Guests

Posted 26 January 2011 - 02:22 AM

i find some php calculator scripts listed on the site PHPKode.
http://www.phpkode.c...hp-calculators/
  • 0

#15 kspr

kspr

    wizard astronaut

  • Speedway Squad
  • 7422 posts
  • Location:Boom City, USA
  • Interests:pin the tail on the elderly
  • Gender:Male

Posted 26 January 2011 - 06:12 AM

Sweet! now i can calculate my mortgage loan! most random spam ever.
  • 0

you awaken in the intestinal tract of satan. you must defeat the hydra to escape. your only weapon is righteous anger. 


#16 lazlo falconi

lazlo falconi

    Knows Nothing

  • YATTAMAN!!
  • 4635 posts
  • Location:Cartoon Hell
  • Interests:Presidency.
  • Gender:Male

Posted 30 January 2011 - 11:38 AM

Why is it that they always spam THIS forum, of all places? Also when will I learn to stop getting excited about new posts here?
  • 0

samussig_zpsf75ec25d.png


Or, to put it more politely, "Neener neener."


-all my friends that came with are drinking out in the car
--forever alone
+\- joke's on them i'm too drunk to drive


#17 SpazCat

SpazCat

    Spazzifras

  • Fluffy Goodness
  • 5966 posts
  • Location:The place where the weather is made up and seasons don't matter.
  • Gender:Female

Posted 30 January 2011 - 01:40 PM

They do it just for you.

Also I'm posting here just to get you excited. Then let your hopes and dreams be crushed once more.
  • 0

:lol:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users