samedi 9 mai 2020

Concatenation & conditions in php

I'm learning PHP and i'm trying to show an " €" when and only when $autocollant_total_ht_custom isset.

This is what i wrote :

  $euro = " €";

  if (isset($autocollant_total_ht_custom)) {
    $autocollant_total_ht_custom = $autocollant_total_ht_custom . $euro;
  } else echo " ";

However my " €" is always showing even when $autocollant_total_ht_custom is not set.

I spent 75 minutes on it, trying and failing again and again despite researching.

I also tried with !is_null, !is_empty with the same result.

I'm fairly certain that my logic isn't wrong but the way to do it is.

Anyone to the rescue?

Have a nice Saturday everyone !

Mike.

Aucun commentaire:

Enregistrer un commentaire