fork(2) download
  1. <?php
  2. $indice_enti = '[{"ripartizione_geografica":"ITALIA NORD-OCCIDENTALE","descrizione_provincia":"Torino","data_ingresso_siope":"2007-01-01T00:00:00Z","codice_sottocomparto":"COMUNE","codice_provincia":"001","descrizione_regione":"PIEMONTE","numero_abitanti":2669,"descrizione_ente":"COMUNE DI AGLIE\'","descrizione_ente_not_stemmed":"COMUNE DI AGLIE\'","codice_regione":"01","codice_fiscale":"83501790014 ","codice_comparto":"PRO","codice_comune":"001","codice_ente":"011142764","data_uscita_siope":"9999-12-31T23:59:00Z","_version_":1488188649331752960},{"ripartizione_geografica":"ITALIA NORD-OCCIDENTALE","descrizione_provincia":"Novara","data_ingresso_siope":"2007-01-01T00:00:00Z","codice_sottocomparto":"COMUNE","codice_provincia":"003","descrizione_regione":"PIEMONTE","numero_abitanti":1556,"descrizione_ente":"COMUNE DI BAGRATE CONTURBIA","descrizione_ente_not_stemmed":"COMUNE DI AGRATE CONTURBIA","codice_regione":"01","codice_fiscale":"00471090035 ","codice_comparto":"PRO","codice_comune":"001","codice_ente":"011120674","data_uscita_siope":"9999-12-31T23:59:00Z","_version_":1488188649334898688},{"ripartizione_geografica":"ITALIA NORD-OCCIDENTALE","descrizione_provincia":"Cuneo","data_ingresso_siope":"2007-01-01T00:00:00Z","codice_sottocomparto":"COMUNE","codice_provincia":"004","descrizione_regione":"PIEMONTE","numero_abitanti":173,"descrizione_ente":"COMUNE DI ZACCEGLIO","descrizione_ente_not_stemmed":"COMUNE DI ZACCEGLIO","codice_regione":"01","codice_fiscale":"00481380046 ","codice_comparto":"PRO","codice_comune":"001","codice_ente":"011120809","data_uscita_siope":"9999-12-31T23:59:00Z","_version_":1488188649334898689},{"ripartizione_geografica":"ITALIA NORD-OCCIDENTALE","descrizione_provincia":"Asti","data_ingresso_siope":"2007-01-04T00:00:00Z","codice_sottocomparto":"COMUNE","codice_provincia":"005","descrizione_regione":"PIEMONTE","numero_abitanti":1686,"descrizione_ente":"COMUNE DI AGLIANO","descrizione_ente_not_stemmed":"COMUNE DI AGLIANO","codice_regione":"01","codice_fiscale":"82000250058 ","codice_comparto":"PRO","codice_comune":"001","codice_ente":"000720006","data_uscita_siope":"9999-12-31T23:59:00Z","_version_":1488188649334898690},{"ripartizione_geografica":"ITALIA NORD-OCCIDENTALE","descrizione_provincia":"Alessandria","data_ingresso_siope":"2006-01-02T00:00:00Z","codice_sottocomparto":"COMUNE","codice_provincia":"006","descrizione_regione":"PIEMONTE","numero_abitanti":20238,"descrizione_ente":"COMUNE DI ACQUI TERME","descrizione_ente_not_stemmed":"COMUNE DI ACQUI TERME","codice_regione":"01","codice_fiscale":"00430560060 ","codice_comparto":"PRO","codice_comune":"001","codice_ente":"010697333","data_uscita_siope":"9999-12-31T23:59:00Z","_version_":1488188649335947264}]';
  3. $data_indice_enti = json_decode($indice_enti, true);
  4.  
  5. function sort_alphabetically($a, $b)
  6. {
  7. global $data_indice_enti;
  8. if ($a->$data_indice_enti['descrizione_ente'] > $b->$data_indice_enti['descrizione_ente']) {
  9. return -1;
  10. } else if ($a->$data_indice_enti['descrizione_ente'] < $b->$data_indice_enti['descrizione_ente']) {
  11. return 1;
  12. } else {
  13. return 0;
  14. }
  15. }
  16.  
  17. usort($data_indice_enti, 'sort_alphabetically');
  18.  
  19. foreach ($data_indice_enti as $ente) {
  20. $codice_comparto = $ente['codice_comparto'];
  21. $codice_ente = $ente['codice_ente'];
  22. $descrizione_ente = $ente['descrizione_ente'];
  23. echo '<option value="'. $codice_comparto .' - '. $codice_ente .'">'. $descrizione_ente. '</option>';
  24. }
  25. ?>
Success #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
<option value="PRO - 011142764">COMUNE DI AGLIE'</option><option value="PRO - 011120674">COMUNE DI BAGRATE CONTURBIA</option><option value="PRO - 011120809">COMUNE DI ZACCEGLIO</option><option value="PRO - 000720006">COMUNE DI AGLIANO</option><option value="PRO - 010697333">COMUNE DI ACQUI TERME</option>
stderr
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 8
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 8
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Notice:  Undefined index: descrizione_ente in /home/yCf6wk/prog.php on line 10
PHP Notice:  Trying to get property of non-object in /home/yCf6wk/prog.php on line 10
PHP Warning:  usort(): Array was modified by the user comparison function in /home/yCf6wk/prog.php on line 17