#!/usr/bin/php ['script', 'script'], 'css' => ['link', 'style'], ]; $html_content = preg_replace_callback( '~<'. $modes[$mode][0] .'[^>]+'.$find.'[^>]*>~', function() use ($modes, $mode, $sourcefile) { return '<'. $modes[$mode][1] . '>'.file_get_contents($sourcefile).''; }, $html_content ); file_put_contents($filename, $html_content); } embed($_SERVER['argv'][1], $_SERVER['argv'][2], $_SERVER['argv'][3], $_SERVER['argv'][4]);