The with function returns the value it is given. If a closure is passed as the second argument to the function, the closure will be executed and its returned value will be returned:
<?php $callback = function ($value) {
    return (is_numeric($value)) ? $value * 2 : 0;
};

$result = with(5, $callback);


$result = with(null, $callback);


$result = with(5, null);