Saturday, September 24, 2022
HomeWordPress Developmentdeadly erro in a single line if statment in wordpress plugin

deadly erro in a single line if statment in wordpress plugin


I hope you may have a superb day.
I looked for the reply to my query however didn’t discover a resolution. please information me
I wish to use if statment and
If the primary identify of the consumer will not be empty, I’ll show it,
in any other case I’ll show the username
It really works appropriately with the if assertion,

<?php
            if(strlen($current_user->user_firstname) != 0){
                echo '<div>Reserved as ' . $current_user->user_firstname . " " . $current_user->user_lastname . '</div>';
            }else{
                echo '<div>Reserved as ' . $current_user->display_name . '</div>';
            }?>

however within the one line if assertion, the error deadly error: exception thrown with no stack body is displayed.

<?php if(strlen($current_user->user_firstname) == 0) ? echo $current_user->display_name : echo $current_user->user_firstname; ?>

I’ve Phrase Press model 6.0.2 on native host utilizing Native v6.4.2+6012
thanks to your assist

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments