Skip to main content
Asked a question 6 months ago

How to check if values in array are true echo something If false leave empty?

Where am I?

In Snowdev you can ask and answer questions and share your experience with other developers!

You can do it by using PHP if
For example,

<?php
$config = array('true' => true,'false' => false);

if($config['true'] === true) {
    echo "It is true";
      } /* else {
     // leave empty
      } */

if($config['false'] === true) {
    echo "It is false";
      } /* else {
     // leave empty
      } */
?>

You can do it by putting something like

$config = array('one' => true,'two' => false);

And the output become

When

$config['one']

Returns true

And when

$config['two']

Returns false

Related Questions

No related questions.