Something like
```
$data = compile_time_routine(function() {
    return json_decode(file_get_contents("large.json"), true);
});
```
being equivalent at runtime to
```
$data = array(...whatever json_decode returned...);
```
and
```
echo "opcache compiled at " . compile_time_routine(function(){return
date(DateTime::RFC3339);});
```
being equivalent at runtime to
```
echo "opcache compiled at " . "2023-03-16T09:43:00+01:00";
```

- at my work there are jsons which is being fetched/parsed like
```
$data=json_decode(file_get_contents("large.json"), true);
```
several times per second, while it would be fine for them to only be
fetched/parsed every time opcache is reset.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to