Title without  

Simple question : When I echo my title doing <?php echo "<li><h3>".$event->title()->string()."</h3></li>" ?> I have NoBreakSpace like that <h3>firstWord&nbsp;secondWord</h3>

But I want to compare My title doing a if($event->title() != $event->first_name()->data().' '.$event->last_name())

Is it normal or no ?

I don’t know where the non-breaking space comes from, but there are a few strange things in your code:

  • do not echo HTML tags (bad coding style), your HTML should look like this:

    <li><h3><?= $event->title()->html() ?></h3></li>
    
  • there is no string() field method, unless that is a custom field method of yours

  • $event->first_name()->data()

    There is no data() field method.

Your comparison should look like this:

if($event->title()->value() !== $event->first_name()->value() . ' ' . $event->last_name()->value()) {
  // do something;
}

Sorry, I tried all of this and nothing runs… It was just a bad copy/past… My bad