MiniFunx for dummies
๐ฎ๐น Di seguito le funzioni PHP presenti in MiniFunx spiegate e con esempi d'uso.
CLI()
CONTAINS()
COSIM()
CSVTOARRAY()
DATE_ITALIAN()
DEACCENT()
DIACRITICS()
ENDS_WITH()
FACTORIAL()
FCLOSE_MULTI()
HAS_NUMBERS()
INCLUDE_MULTI()
LISTFILES()
RASNA()
REACCENT()
REQUIRE_MULTI()
SPACES()
STARTS_WITH()
TIMEZONE()
TIMEZONE()
UNICODETOUTF8()
URL_GET_CONTENTS()
WORD2VEC()
Last update: May 2025.
๐ฌ๐ง Here you may find MiniFunx PHP functions with explanations and usage exemples.
๐ฎ๐น 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>");
๐ฎ๐น 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"; }
๐ฎ๐น 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);
๐ฎ๐น Importa un file .csv direttamente in un'array.
๐ฌ๐ง It loads a .csv file directly into an array.
$data = csvtoarray("myfile.csv");
๐ฎ๐น 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");
๐ฎ๐น 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.");
๐ฎ๐น 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.");
๐ฎ๐น 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"; }
๐ฎ๐น Calcola il fattoriale di un numero intero.
๐ฌ๐ง It calculates the factorial of an integer number.
$result = factorial(6);
๐ฎ๐น Chiude piรน file alla volta.
๐ฌ๐ง It closes more files at a time.
fclose_multi("one.csv","two.txt","three");
๐ฎ๐น 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 piรน file alla volta.
๐ฌ๐ง It includes more files at a time.
include_multi("one.php","two.php","three.php");
๐ฎ๐น 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/");
๐ฎ๐น 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");
๐ฎ๐น 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.");
๐ฎ๐น Richiede piรน file alla volta.
๐ฌ๐ง It requires more files at a time.
require_multi("one.php","two.php","three.php");
๐ฎ๐น Elimina gli spazi in eccesso in una stringa.
๐ฌ๐ง It deletes redundant spaces in a string.
echo spaces(" Once upon a time ");
๐ฎ๐น 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"; }
๐ฎ๐น Definisce il fuso orario locale da usare.
๐ฌ๐ง It sets the local time zone to be used.
timezone("Europe/Rome");
๐ฎ๐น Definisce il fuso orario locale da usare.
๐ฌ๐ง It sets the local time zone to be used.
timezone("Europe/Rome");
๐ฎ๐น Converte notazioni unicode in caratteri con codifica utf8.
๐ฌ๐ง It converts Unicode notations to utf8 characters.
$text = unicodetoutf8("Questa \u00e8 la tua casa");
๐ฎ๐น 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");
๐ฎ๐น 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"]);