Litterae.eu
Humanities & IT


MiniFunx for dummies

๐Ÿ‡ฎ๐Ÿ‡น Di seguito le funzioni PHP presenti in MiniFunx spiegate e con esempi d'uso.
๐Ÿ‡ฌ๐Ÿ‡ง Here you may find MiniFunx PHP functions with explanations and usage exemples.

CLI()
๐Ÿ‡ฎ๐Ÿ‡น Sostituisce <br> con \n, se PHP sta funzionando da terminale.
๐Ÿ‡ฌ๐Ÿ‡ง It replaces <br> with \n if PHP is running from terminal (CLI).
echo cli("Break after this line.<br>");

CONTAINS()
๐Ÿ‡ฎ๐Ÿ‡น Verifica se una stringa contiene un dato testo. Non distingue tra maiuscole e minuscole.
๐Ÿ‡ฌ๐Ÿ‡ง It checks if a string contains a word. Case insensitive check.
if (contains("Alice in Wonderland","in")) { echo "ok"; } else { echo "no"; }

COSIM()
๐Ÿ‡ฎ๐Ÿ‡น Utilizza la funzione trigonometrica del coseno di similitudine per calcolare la somiglianta tra due vettori (matrici o array) numerici; 1 indica identitร  tra i due.
๐Ÿ‡ฌ๐Ÿ‡ง It uses the trigonometric similarity cosine function to calculate the similarity between two numerical vectors (matrices or arrays); 1 indicates identity between the two.
$similarity = cosim($vector1,$vector2);

CSVTOARRAY()
๐Ÿ‡ฎ๐Ÿ‡น Importa un file .csv direttamente in un'array.
๐Ÿ‡ฌ๐Ÿ‡ง It loads a .csv file directly into an array.
$data = csvtoarray("myfile.csv");

DATE_ITALIAN()
๐Ÿ‡ฎ๐Ÿ‡น Converte una stringa data nel formato italiano: nome del giorno, data, nome del mese, anno.
๐Ÿ‡ฌ๐Ÿ‡ง It converts a date string to the Italian format and language: day name, day number, month name, year.
$date = date_italian("2023/05/24");

DEACCENT()
๐Ÿ‡ฎ๐Ÿ‡น Ricodifica le lettere con segni diacritici, ad esempio per usare una stringa come parte di un indirizzo.
๐Ÿ‡ฌ๐Ÿ‡ง It removes and codes accents in a string, e.g. for URL purposes.
$page = deaccent("C'รจ chi sรฌ e c'รจ chi no.");

DIACRITICS()
๐Ÿ‡ฎ๐Ÿ‡น Elimina segni diacritici e accenti da una stringa in caratteri latini, ad esempio per usarla come parte di un indirizzo.
๐Ÿ‡ฌ๐Ÿ‡ง It removes diacritics and accents in a string encoded in Latin characters, e.g. for URL purposes.
$page = diacritics("D'oรน la tempรชte est arrivรฉe.");

ENDS_WITH()
๐Ÿ‡ฎ๐Ÿ‡น Verifica se una stringa finisce con un dato testo. Non distingue tra maiuscole e minuscole.
๐Ÿ‡ฌ๐Ÿ‡ง It checks if a string ends with a given text. Case insensitive check.
if (ends_with("Alice in Wonderland","land")) { echo "ok"; } else { echo "no"; }

FACTORIAL()
๐Ÿ‡ฎ๐Ÿ‡น Calcola il fattoriale di un numero intero.
๐Ÿ‡ฌ๐Ÿ‡ง It calculates the factorial of an integer number.
$result = factorial(6);

FCLOSE_MULTI()
๐Ÿ‡ฎ๐Ÿ‡น Chiude piรน file alla volta.
๐Ÿ‡ฌ๐Ÿ‡ง It closes more files at a time.
fclose_multi("one.csv","two.txt","three");

HAS_NUMBERS()
๐Ÿ‡ฎ๐Ÿ‡น Verifica se una stringa contiene dei numeri.
๐Ÿ‡ฌ๐Ÿ‡ง It checks if a string contains any numbers.
if (has_numbers("Born in 1999.")) { echo "ok"; } else { echo "no"; }

INCLUDE_MULTI()
๐Ÿ‡ฎ๐Ÿ‡น Include piรน file alla volta.
๐Ÿ‡ฌ๐Ÿ‡ง It includes more files at a time.
include_multi("one.php","two.php","three.php");

LISTFILES()
๐Ÿ‡ฎ๐Ÿ‡น Elenca tutti i file di una cartella e delle sue sottocartelle, mettendoli in un'array.
๐Ÿ‡ฌ๐Ÿ‡ง It lists all the files in a folder and its subfolders, and push them into an array.
$files = listfiles("path/to/my/folder/");

RASNA()
๐Ÿ‡ฎ๐Ÿ‡น Converte testo latino destrorso in caratteri sinistrorsi etruschi del blocco Old Italian Unicode; necessita del font Rasna Haiku per funzionare correttamente.
๐Ÿ‡ฌ๐Ÿ‡ง It converts Latin text to Old Italic Unicode RTL for Etruscan; it needs the Rasna Haiku font to work properly.
echo rasna("acale");

REACCENT()
๐Ÿ‡ฎ๐Ÿ‡น Ripristina i segni diacritici codificati con deaccent().
๐Ÿ‡ฌ๐Ÿ‡ง It decodes and rewrites the accents of a string previously coded with deaccent().
$page = reaccent("C|e1_chi_si1_e_c|e1_chi_no.");

REQUIRE_MULTI()
๐Ÿ‡ฎ๐Ÿ‡น Richiede piรน file alla volta.
๐Ÿ‡ฌ๐Ÿ‡ง It requires more files at a time.
require_multi("one.php","two.php","three.php");

SPACES()
๐Ÿ‡ฎ๐Ÿ‡น Elimina gli spazi in eccesso in una stringa.
๐Ÿ‡ฌ๐Ÿ‡ง It deletes redundant spaces in a string.
echo spaces(" Once        upon a    time ");

STARTS_WITH()
๐Ÿ‡ฎ๐Ÿ‡น Verifica se una stringa inizia con un dato testo. Non distingue tra maiuscole e minuscole.
๐Ÿ‡ฌ๐Ÿ‡ง It checks if a string starts with a given text. Case insensitive check.
if (starts_with("Alice in Wonderland","alice")) { echo "ok"; } else { echo "no"; }

TIMEZONE()
๐Ÿ‡ฎ๐Ÿ‡น Definisce il fuso orario locale da usare.
๐Ÿ‡ฌ๐Ÿ‡ง It sets the local time zone to be used.
timezone("Europe/Rome");

TIMEZONE()
๐Ÿ‡ฎ๐Ÿ‡น Definisce il fuso orario locale da usare.
๐Ÿ‡ฌ๐Ÿ‡ง It sets the local time zone to be used.
timezone("Europe/Rome");

UNICODETOUTF8()
๐Ÿ‡ฎ๐Ÿ‡น Converte notazioni unicode in caratteri con codifica utf8.
๐Ÿ‡ฌ๐Ÿ‡ง It converts Unicode notations to utf8 characters.
$text = unicodetoutf8("Questa \u00e8 la tua casa");

URL_GET_CONTENTS()
๐Ÿ‡ฎ๐Ÿ‡น Alternativa a file_get_contents() per file remoti.
๐Ÿ‡ฌ๐Ÿ‡ง An alternative to file_get_contents() for remote files.
$remotefile = url_get_contents("www.thatsite.com/page.html");

WORD2VEC()
๐Ÿ‡ฎ๐Ÿ‡น Vettorizza le parole di un dato corpus in matrici di 100 numeri ciascuna. NB. Restituisce due array: lista delle parole uniche e rispettivi vettori; tutto รจ ridotto in minuscolo.
๐Ÿ‡ฌ๐Ÿ‡ง It vectorizes the words of a given corpus as arrays of 100 numbers each. NB. It returns two arrays: list of unique words, and correspondent vectors; everything is in lower case.
$text = file_get_contents("corpus.txt"); $word_vectors = word2vec($text); print_r($word_vectors["word"]);

Last update: May 2025.


Site designed by litterae.eu. © 2004-2025. All rights reserved.
Info GDPR EU 2016/679: no cookies used, no personal data collected.
p.iva / vat number: 02757940206