Support » Plugins and Hacks » "echo str_replace" within an echo and if statement?

  • Having trouble with a “echo str_replace” command within an echo. The code below outputs 3 layers when conditions are met. The “echo str_replace” command and the first two layers work, but having trouble with the third layer. How can you insert the “echo str_replace” to output into the third layer…….

    <?php
    if($item->product_id == ‘2’){
    if($item->quantity == ‘2’) { echo ‘<img src=”ticket2.jpg”>’;
    echo ‘<div id=”Layer1″> ‘. $name->first_name . ‘</div>’; }

    elseif($item->quantity == ‘3’) { echo ‘<img src=”ticket3.jpg” >’;
    echo ‘<div id=”Layer2″> ‘ . $name->last_name . ‘</div>’;
    echo ‘<div id=”Layer1″> ‘ . $name->middle_name . ‘</div>’;

    ; }

    else { echo ‘<div id=”Layer3″> ‘ . $name->middle_name . echo str_replace(“‘”, “‘”, $item->description);
    ‘</div>’;
    }
    }
    ?>

  • The topic ‘"echo str_replace" within an echo and if statement?’ is closed to new replies.