Home  >  Q&A  >  body text

Why can't the second one be executed? ? ?

<?php


$n = 2;


##function dg( $n ){


## echo $n.'<br />';


$n = $n - 1;

## if($n > 0){

//Call dg itself in the function body

dg($n );

}else{

## echo '------------- -';


}

## echo 'I'm a bitch, I haven't executed it yet' . $n . '<br />';


}

?>

不是铭跃不是铭跃2663 days ago1400

reply all(2)I'll reply

  • 益伦

    益伦2017-10-16 22:24:23

    <?php

    $n = 2;

    function dg( $n ){

    echo $n.'<br />';

    $n = $n - 1;

    if($n > 0){

    //Called dg itself in the function body

    dg($n);

    }else{

    echo '--------------';

    }

    echo 'I'm a bitch, I haven't executed it yet' . $n . '<br />';

    }

    dg($n);

    ?>


    There is no function called, just add dg($n); after it


    reply
    0
  • phpcn_u3204

    phpcn_u32042017-06-07 18:26:25

    You didn’t call the function

    reply
    0
  • Cancelreply