troubleshooting Question

explain this code and static values

Avatar of rgb192
rgb192Flag for United States of America asked on
6 Comments2 Solutions359 ViewsLast Modified:

$originalValue = "5'10\"";
echo "{$originalValue} = " . Converter::ToInches($originalValue) . " total inches!\n";

$originalValue = "female";
echo "{$originalValue} = " . Converter::ToInches($originalValue) . " total inches!\n";

class Converter
  public static function ToInches($original)
          $feet = intval($matches[1]);
          $inches = intval($matches[2]);
          return ($feet * 12) + $inches;
          throw new Exception("I don't understand the value {$original}!");

Please explain the reason why this code works

I am learning about object oriented program and static values.

Why is a static value best for this requirement?
Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros