$act_I=true;
$act_II=true;
$act_III=true;
$act_IV=true;
$act_V=false;
$act_VI=true;
$act_VII=true;
$act_VIII=false;
somefunc4();
if(!$act_I){
echo "Act I is not done";
}
else{
somefunc1();
if(!$act_II){
echo "Act I is done,but act II is not done";
}
else{
somefunc2();
somefunc1();
somefunc4();
if(!$act_III){
echo "Act I,II is done,but act III is not done";
}
else{
somefunc2();
somefunc3();
if(!$act_IV){
echo "Act I-III is done,but act IV is not doing";
}
else{
somefunc1();
somefunc4();
somefunc2();
somefunc3();
if(!$act_V){
echo "Act I-IV is done,but act V is not done";
}
else{
somefunc3();
if(!$act_VI){
echo "Act I-V is done,but act VI is not done";
}
else{
somefunc3();
somefunc1();
somefunc2();
if(!$act_VII){
echo "Act I-VI is done,but act VII is not done";
}
else{
somefunc4();
if(!$act_VIII){
echo "Act I-VII is done,but act VIII is not done";
}
else{
echo "All acts are done";
}
}
}
}
}
}
}
}
function somefunc1(){
return;
}
function somefunc2(){
return;
}
function somefunc3(){
return;
}
function somefunc4(){
return;
}
Я ему посоветовала сделать так:
$act_I=true;
$act_II=true;
$act_III=true;
$act_IV=true;
$act_V=false;
$act_VI=true;
$act_VII=true;
$act_VIII=false;
somefunc4();
if(!$act_I){
die("Act I is not done");
}
somefunc1();
if(!$act_II){
die("Act I is done,but act II is not done");
}
somefunc2();
somefunc1();
somefunc4();
if(!$act_III){
die("Act I,II is done,but act III is not done");
}
somefunc2();
somefunc3();
if(!$act_IV){
die("Act I-III is done,but act IV is not done");
}
somefunc1();
somefunc4();
somefunc2();
somefunc3();
if(!$act_V){
die("Act I-IV is done,but act V is not done");
}
somefunc3();
if(!$act_VI){
die("Act I-V is done,but act VI is not done");
}
somefunc3();
somefunc1();
somefunc2();
if(!$act_VII){
die("Act I-VI is done,but act VII is not done");
}
somefunc4();
if(!$act_VIII){
die("Act I-VII is done,but act VIII is not done");
}
echo "All acts are done";
function somefunc1(){
return;
}
function somefunc2(){
return;
}
function somefunc3(){
return;
}
function somefunc4(){
return;
}
Попросил убедить,так как в какой-то книге он прочитал,что его вариант лучше.Кроме убеждения против лапшекода ничего на ум не идет.
а как бы вы поступили?