I have a problem in display or echo in php.

what method should i follow if i the problem is with like this:
example code:

$email = trim($_REQUEST["email"]);

if(strlen($email) < 1){
echo "0__notice__Email is empty.";

but the output should display only this part
"Email is empty." only and not the whole echo.

"Email is empty." --> this part only
"0__notice__Email is empty." --> not the whole display like this.

6 Years
Discussion Span
Last Post by decade

you decide what the function echo should display but if this is error message stored in array of errors for example and you want to get rid of the these characters when displaying the error , then use a function


function clean_error($error) {
return str_replace("0__notice__","",$error);

echo clean_error("0__notice__Email is empty");


Edited by Amr87: n/a

Votes + Comments

Didn't understand the logic of writing echo "0__notice__Email is empty."; and expecting Email is empty as output. Can u explain..

Edited by vibhaJ: n/a


to: vibhadevit
thanks but i try to use this "error message" for ajax, its only has simple logic. the underscore mark would be my delimiter and the "0" refer to my status. well i've already solve the problem. thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.