Place if statement in echo
<p>I have a line of code that looks like this:</p>

<pre><code>echo "Slope intercept form: $$"."y = ".toFraction($slope)."x + $b"."$$";
</code></pre>

<p>However, I want to add an if statement that checks if the number is a decimal to run the function "toFraction". And if it's not a fraction, I want it just to echo the $slope variable without the function. In other words, something like this:</p>

<pre><code>echo "Slope intercept form: $$"."y = ".if(strpos($number,".") !== false){toFraction($slope)}else{$slope}."x + $b"."$$";
</code></pre>

<p>However, I'm not sure if this is even possible, or if it is, what is the proper way of accomplishing it?</p>
