Turning an Object into a string in PHP

If the response is a string then you can do something like:

<?php
$extraClass="";
$price = $my_property->price();
if (false !== strpos($price, 'Monthly)) {
    $extraClass="rental";
}
?>
<span class="price <?php $extraClass><"><?php $price ?></span>

Or something like that, depending on why you actually want to test for rental.

Leave a Comment