fork download
  1. <?php
  2.  
  3. $array = Array(
  4. (0) => Array
  5. (
  6. forn_nome_fantasia => 'FORNECEDOR TESTE',
  7. class_nvl4_descricao => 'DESPESAS COM FRETES',
  8. )
  9. ,
  10. (1) => Array
  11. (
  12. forn_nome_fantasia => 'DJ/ DESEO -SALA DE ESTAR',
  13. class_nvl4_descricao => 'FRETES',
  14.  
  15. )
  16. ,
  17. (2) => Array
  18. (
  19. forn_nome_fantasia => 'DJ/ DESEO -SALA DE ESTAR',
  20. class_nvl4_descricao => 'DESPESAS COM FRETES',
  21.  
  22. )
  23. ,
  24. (3) => Array
  25. (
  26. forn_nome_fantasia => 'DJ/ DESEO -SALA DE ESTAR',
  27. class_nvl4_descricao => 'DESPESAS COM FRETES',
  28.  
  29. )
  30. );
  31.  
  32. foreach($array as $idx => $texto){
  33. for($x=$idx+1;$x<sizeof($array);$x++){
  34. if( $array[$idx]['class_nvl4_descricao'] == $array[$x]['class_nvl4_descricao'] ){
  35. $array[$x]['class_nvl4_descricao'] = 'removido';
  36. }
  37. }
  38. }
  39.  
  40. echo $array[0]['class_nvl4_descricao'].'<br>';
  41. echo $array[1]['class_nvl4_descricao'].'<br>';
  42. echo $array[2]['class_nvl4_descricao'].'<br>';
  43. echo $array[3]['class_nvl4_descricao'].'<br>';
Success #stdin #stdout #stderr 0s 82880KB
stdin
Standard input is empty
stdout
DESPESAS COM FRETES<br>FRETES<br>removido<br>removido<br>
stderr
PHP Notice:  Use of undefined constant forn_nome_fantasia - assumed 'forn_nome_fantasia' in /home/mtqnNS/prog.php on line 6
PHP Notice:  Use of undefined constant class_nvl4_descricao - assumed 'class_nvl4_descricao' in /home/mtqnNS/prog.php on line 7
PHP Notice:  Use of undefined constant forn_nome_fantasia - assumed 'forn_nome_fantasia' in /home/mtqnNS/prog.php on line 12
PHP Notice:  Use of undefined constant class_nvl4_descricao - assumed 'class_nvl4_descricao' in /home/mtqnNS/prog.php on line 13
PHP Notice:  Use of undefined constant forn_nome_fantasia - assumed 'forn_nome_fantasia' in /home/mtqnNS/prog.php on line 19
PHP Notice:  Use of undefined constant class_nvl4_descricao - assumed 'class_nvl4_descricao' in /home/mtqnNS/prog.php on line 20
PHP Notice:  Use of undefined constant forn_nome_fantasia - assumed 'forn_nome_fantasia' in /home/mtqnNS/prog.php on line 26
PHP Notice:  Use of undefined constant class_nvl4_descricao - assumed 'class_nvl4_descricao' in /home/mtqnNS/prog.php on line 27