@anonymous/

ImmaculateEnchantedTurkey

PHP (Legacy)

No description

fork
loading
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$status = array();
$status[1]["Visualizar"] = "Visualizar";
$status[2]["Editar"] = "Editar";
$status[3]["Status"] = "Alterar Status";
$status[4]["Boleto"] = "Gerar Boleto";

$codstatus = 3;

if ($codstatus == 3){
  $status["Status"] = "Alterar Status";
}else{
  unset($status["Status"]);
}

var_dump($status);

// MINHA SUGESTÃO

$status = array();
$status[1] = "Visualizar";
$status[2] = "Editar";
$status[3] = "Alterar Status";
$status[4] = "Gerar Boleto";

$codstatus = 3;

if ($codstatus == 3){
  $status[3] = "Alterar Status";
}else{
  unset($status[3]);
}

var_dump($status);
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7