Can we get compile time routines?

From: Date: Thu, 16 Mar 2023 14:40:46 +0000
Subject: Can we get compile time routines?
Groups: php.internals 
Request: Send a blank email to internals+get-119726@lists.php.net to get a copy of this message
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.

« previous php.internals (#119726) next »