shamuraq Posted May 27, 2009 Share Posted May 27, 2009 Scenario: $a = 1; $b = rand(2,9); $c = $a/$b; Question: How do i store $c as fraction instead of it solving $a/$b? Thanx in advance... Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 27, 2009 Share Posted May 27, 2009 $c = $a . '/' . $b; That won't be simplified fraction. You'll have to do some math to get a simplified version. Quote Link to comment Share on other sites More sharing options...
shamuraq Posted May 27, 2009 Author Share Posted May 27, 2009 Thanx Ken... Quote Link to comment Share on other sites More sharing options...
dzelenika Posted June 25, 2009 Share Posted June 25, 2009 use class with public members $a and $b Example: clas fraction { public $a; public $b; } $c = new fraction(); $c->a = 5; $c->b = 7; Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 26, 2009 Share Posted June 26, 2009 use class with public members $a and $b Example: clas fraction { public $a; public $b; } $c = new fraction(); $c->a = 5; $c->b = 7; Why public members? I also don't get the point of this post. This problem is solved a month ago. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.