<?php
function get_video_block($id) {
return "***replacement text for $id***";
}
function display_video($text) {
return preg_replace_callback(
'/\[VIDEO ID=(\d+)]/',
function($m) {
return get_video_block($m[1]);
},
$text
);
}
echo display_video("Here is a video [VIDEO ID=33] to watch");
Here is a video ***replacement text for 33*** to watch
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Here is a video ***replacement text for 33*** to watch