Skip to content

Instantly share code, notes, and snippets.

View BenMorel's full-sized avatar
🤝
Open to work. Drop me an email!

Benjamin Morel BenMorel

🤝
Open to work. Drop me an email!
View GitHub Profile
@BenMorel
BenMorel / SafeCast.php
Last active October 8, 2024 16:52
Safe casting to int (WIP)
<?php
final class SafeCast
{
/**
* Converts the given variable to an integer.
*
* Allowed types are int, float and string.
*
* - int values are returned as is;
@BenMorel
BenMorel / generate-jit-php-ini.php
Last active January 15, 2023 00:03
Generates a php.ini file compatible with PHP JIT compiler
<?php
/**
* Generates a php.ini file from runtime ini directives, excluding extensions incompatible with JIT.
* I did not find a way to disable an extension from the command line, so this script is a workaround.
*
* Use it this way:
*
* php generate-jit-php-ini.php > php.ini
* php -n -c php.ini