Parse error after upgrading to PHP 5.3
- by poer
I have a php code that works well in PHP 5.2 but throwing "Parse error: syntax error, unexpected '}'" after upgrading to PHP 5.3.
When I use echo/print or heredocs to print all the HTML part of the code, the error is gone.
My question is, why this error occurred? Is this mean that in PHP 5.3 we are no longer allowed to put HTML code inside PHP code?
This is my php code:
function pk_stt2_admin_print_delete_form(){
global $wpdb;
if ( isset($_POST['delete_terms']) && !empty($_POST['delete_terms']) ){
$msg = 'Search terms';
$success = pk_stt2_db_delete_searchterms( $_POST['delete_terms'] );
} elseif ( isset($_POST['delete_all']) ){
$msg = 'All search terms';
$success = pk_stt2_db_delete_searchterms( 'delete_all_terms' );
} else {
?>
<div id="message" class="updated fade">
<p> Please enter the search terms to be deleted, separate them with a comma.
</p>
</div>
<?php
}
if ( $success ){
?>
<div id="message" class="updated fade">
<p> <?php echo $msg; ?> have been deleted,
<?php echo $success; ?> rows effected.
</p>
</div>
<?php
} else {
?>
<div id="message" class="updated fade">
<p> Failed to delete search terms.
</p>
</div>
<?php
}
}
Thanks.