GitHub - roberto-butti/50-drops-of-php: Open source and free e-book, that collects some useful, unknown, underrated PHP functions or stuff discovered, used, learned during the PHP daily use.
Extracto
Open source and free e-book, that collects some useful, unknown, underrated PHP functions or stuff discovered, used, learned during the PHP daily use. - GitHub - roberto-butti/50-drops-of-php: Open...
Resumen
Resumen Principal
El repositorio "50 drops of PHP" de Roberto Butti constituye una valiosa recopilación de funciones y características de PHP que, aunque útiles y prácticas, tienden a ser desconocidas o subutilizadas por la mayoría de desarrolladores. Este e-book gratuito y de código abierto surge de la experiencia diaria con el lenguaje, ofreciendo insights prácticos que pueden optimizar significativamente el trabajo cotidiano de los programadores PHP. La iniciativa destaca por su enfoque en funcionalidades subestimadas que, pese a estar disponibles en versiones estándar del lenguaje, rara vez forman parte del arsenal habitual de los desarrolladores. La obra no solo presenta funciones aisladas, sino que contextualiza su uso mediante ejemplos derivados del trabajo real, lo que incrementa su aplicabilidad inmediata. Este enfoque práctico convierte al recurso en una herramienta especialmente útil para quienes buscan mejorar su eficiencia sin recurrir a soluciones externas o librerías de terceros. La naturaleza open source del proyecto además permite que la comunidad contribuya y amplíe su contenido, asegurando su actualización y relevancia continua en el ecosistema PHP.
Elementos Clave
- Funciones desconocidas de PHP: El contenido se centra en funciones nativas del lenguaje que, aunque disponibles, no son comúnmente utilizadas, lo que puede llevar a soluciones más simples y eficientes.
- Experiencia práctica del autor: Las funciones y técnicas presentadas provienen del uso real y diario de PHP, lo que garantiza su aplicabilidad y relevancia para desarrolladores en activo.
- Formato de libro digital gratuito: El recurso se distribuye como e-book accesible sin costo, facilitando su adopción por parte de una audiencia amplia y diversa.
- Licencia de código abierto: El proyecto permite la colaboración comunitaria, lo que asegura su evolución continua y la incorporación de nuevas funciones útiles con el tiempo.
Análisis e Implicaciones
Este tipo de iniciativas tiene el potencial de mejorar la calidad del código generado por desarrolladores PHP al introducirles herramientas subutilizadas pero poderosas. Además, al ser de acceso libre, democratiza el conocimiento técnico y reduce la brecha entre desarrolladores experimentados y principiantes. La naturaleza colaborativa del proyecto también fomenta una cultura de aprendizaje compartido dentro de la comunidad PHP.
Contexto Adicional
El repositorio está alojado en GitHub, lo que facilita su acceso, seguimiento y contribución por parte de la comunidad global de desarrolladores. La estructura del contenido como colección de "gotas" sugiere una presentación modular y fácil de digerir, ideal para su consulta rápida o estudio progresivo.
Contenido
The Book: 50 drops of PHP
This book collects 50 useful, unknown, underrated PHP functions or stuff discovered, used, learned during the PHP daily use.
Using frameworks daily, sometimes the perception of the power of the language and of the basic functionalities provided by the PHP core could be lost. I see that usually I used to look the framework documentation or looking for a package in Packagist for system, array, string functions instead using some core functionalities provided by the language.
Download PDF version for FREE
You can download your PDF version here: https://hifolks.gumroad.com/l/50-drops-of-php?price=0
50 drops of PHP
Table of Content
- Welcome to 50 drops of PHP
- The reason why
- Continuous release
- Where to find this book
- Thanks to...
- The reason why
- System
- Get used PHP version: phpversion()
- Display OS information: php_uname()
- Get memory usage in bytes: memory_get_usage()
- Get environment variable value: getenv()
- All environment variables
- How to exit: exit()
- Exit parameter
- Shutdown function: register_shutdown_function()
- Listening signals: pcntl_signal()
- Loaded PHP modules: get_loaded_extensions()
- Compare versions: version_compare()
- Comparing without operator
- Comparing with operator
- Retrieve the current Process Identifier: getmypid()
- Get resources usage: getrusage()
- The input parameter $mode
- Return current UNIX timestamp: microtime()
- Why you need to avoid to use microtime() to measure the time
- Get monotonic time: hrtime()
- Get temporary directory: sys_get_temp_dir()
- Get temp file name: tempnam()
- Array
- Apply function to each array elements: array_map()
- A string from an array: join()
- Check if a key exists in the array: key_exists()
- Check if an element is included in the array: in_array()
- Strict comparison
- Case Sensitive
- Merge two arrays: array_merge()
- Key collision: array merge of arrays with numeric keys
- Key collision: array merge of arrays with strings keys
- Generate and fill a new array: range()
- Step
- Creating array from variables: compact()
- Variables, Constants
- Get variable type: gettype()
- Portable directory separator: DIRECTORY_SEPARATOR
- Portable end of line: PHP_EOL()
- Export object properties as array: get_object_vars()
- Functions
- Anonymous functions
- An example with a PHP core function
- Arrow Functions with PHP
- Anonymous functions
- Strings
- Padding strings: str_pad()
- Converting case of a sentences of strings: mb_convert_case()
- Parse string: sscanf()
- Format a string: sprintf()
- Padding
- Numbers (integers)
- Numbers (floats)
- Formatting cheat sheet
- Validating string, alphabetics: ctype_alpha()
- Validating string, digits: ctype_digit()
- Validate strings, lower case letters: ctype_lower()
- Generate unique string: uniqid()
- Store objects or variables: serialize()
- Retrieve saved objects or variables: unserialize()
- Compress content: gzcompress()
- Uncompress content: gzuncompress()
- Delete characters: trim()
- From JSON string to PHP object: json_decode()
- Flags
- Catching errors in parsing
- Big integers
- More than one flag
- Format a string with an array: vsprintf()
- Files
- File information: stat()
- Symbolic link information
- Parsing directory: scandir()
- Split filename infos: pathinfo()
- Create a directory: mkdir()
- Permissions
- Nested directories
- The fingerprint of a file: md5_file()
- Find files that match a pattern: glob()
- Read dir: readdir()
- File information: stat()
Fuente: GitHub
