mardi 4 décembre 2018

Problems using isset with function and if in PHP [duplicate]

This question already has an answer here:

I am having some trouble calling isset on a function.

so if for example, I have a function to tell me a proper date:

    <?php // creates function that gives out proper date today
                function proper_date() {
                $z = date('d-m-Y');
                print("proper date today is: $z");
                } ?>

and I want to check if the function have value or not with isset, and then print out information acording to it:

    <?php 
        function is_it_real () {echo isset proper_date};

        if (is_it_real == 1) { echo "time is real" };
        elseif (is it real == 0) {echo "time is not real"};
        else { echo "time is ilusion"};

    ?>

by my understanding, isset will output 1 into the function is_it_real and then I can use that as a variable to check what I want to print out? However, my website breaks there. What could be done to fix this example? Thanks

Aucun commentaire:

Enregistrer un commentaire