Tag: php

  • Anonimizzare le email di un database con uno script

    Anonimizzare le email di un database con uno script

    È possibile anonimizzare un intero database, colonna per colonna, riga per riga, cella per cella usando un semplice script.

    (altro…)
  • Classi php reference, clone, duplicate

    È molto interessante notare la differenza tra clonazione, duplicazione e referenza ad una classe. In questo piccolo articolo ci chiariremo le idee in tal senso.

    (altro…)
  • List directories with php and compare them

    Sometimes it’s important to quickly highlight differences between two folders structure.

    It could happen expecially when you are obliged to work on cheap environments, without console and you need to understand if there are differences among your local filesystem and the remote one.

    <?php
    
    $dir = __DIR__;
    $scan_result = scandir( $dir );
    foreach ( $scan_result as $key => $value ) {
      if (!in_array($value, array('.', '..'))) {
        if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
          print $value."<br/>";
        }
      }
    }

    You can copy the script in each directory and naming it scandir.php, than reach it by browser at the url http://path-to-your-base-folder/scandir.php.

    In this way you have just executed the script, do it on each environment directory and occasionally compare them.

    To compare there are Notepad++, git diff, WinMerge and plenty of open source tools.

    Scandir is a php function, check it, I have wrote this code using an example I found there.