I am writting a code at the moment at call this code like this:

```
$reduced = is_reduced($pid);
set_sale($pid, $reduced);
echo " - " . $reduced . " - ";

```

So, the logic behind that should be like:
I call the function `is_reduced()` to know, if a product is reduced. Normally, it should return true or false there. But I don't get anything back. You can see, I'm printing the variable with echo to the console. But I don't see anything. Not even NULL!

But on the console I can see, that it gets "is NOT reduced" gets printed out. So, it should also return someting. Because the `echo` is followed by the return command in the function `is_reduced` (Code below).

Some informations to the function:
One page can have multiple prices. This is the reason, why I have the while loop. If there is only one price, I get `-1` back on the var `aktueller_counter`. So, I jump into the first if tribe. There it is checking if there is a lower price and if yes, if this price is not 0, not "" and not lower then -1.

And as you can see, it says `echo` followed by `return`. But why do I not get any NULL or any boolean value back?

I would be very happy about help!
Kind regards!

Here the code:

```
function is_reduced($pid){
    $aktueller_counter = -1;
    while(have_rows('product_shops', $pid)): the_row();
        $aktueller_counter = $aktueller_counter + 1;
    endwhile;

    if($aktueller_counter == -1){
        $price = get_field("product_shops_0_price", $pid);
        $price_old = get_field("product_shops_0_price_old", $pid);

        if($price_old < $price) {
            if ($price_old != "") {
                if ($price_old != 0) {
                    if ($price_old > -1) {
                        $price = null;
                        $price_old = null;
                        $aktueller_counter = null;

                        echo ", is \"reduced\"";

                        return true;
                    } else {
                        $price = null;
                        $price_old = null;
                        $aktueller_counter = null;

                        echo ", is NOT \"reduced\"";

                        return false;
                    }
                } else {
                    $price = null;
                    $price_old = null;
                    $aktueller_counter = null;

                    echo ", is NOT \"reduced\"";

                    return false;
                }
            } else {
                $price = null;
                $price_old = null;
                $aktueller_counter = null;

                echo ", is NOT \"reduced\"";

                return false;
            }
        } else {
            $price = null;
            $price_old = null;
            $aktueller_counter = null;

            echo ", is NOT \"reduced\"";

            return false;
        }
    }else{
        for($i = 0; $i <= $aktueller_counter; $i++){
            $price = get_field("product_shops_".$i."_price", $pid);
            $price_old = get_field("product_shops_".$i."_price_old", $pid);

            if($price_old < $price){
                if($price_old != ""){
                    if($price_old != 0){
                        if($price_old > -1) {
                            $price = null;
                            $price_old = null;
                            $aktueller_counter = null;

                            echo ", is \"reduced\"";

                            return true;
                        }
                    }else {
                        $price_old = null;
                        $price = null;
                    }
                }else {
                    $price_old = null;
                    $price = null;
                }
            }else {
                $price_old = null;
                $price = null;
            }
        }

        $price = null;
        $price_old = null;
        $aktueller_counter = null;

        echo ", is NOT \"reduced\"";

        return false;
    }
}

```