Статьи

Генерация PHP с Ruby

Недавно натолкнулся на интересную статью о генерации веб-сайтов на PHP с использованием Ruby на codegeneration.net (здесь есть раздел PHP). Статья является хорошей отправной точкой для изучения того, что работает, а что нет.

Подумайте, что PHP недооценен в том, что касается генерации кода, учитывая, насколько легко генерировать и динамически выполнять код, например;

< ?php // Some code $code = ' '; // Write code to file file_put_contents('generated.php',$code); # PHP5 function! // Include the generated code for execution include 'generated.php'; ?> < ?php // Some code $code = ' '; // Write code to file file_put_contents('generated.php',$code); # PHP5 function! // Include the generated code for execution include 'generated.php'; ?>

< ?php // Some code $code = ' '; // Write code to file file_put_contents('generated.php',$code); # PHP5 function! // Include the generated code for execution include 'generated.php'; ?>

< ?php // Some code $code = ' '; // Write code to file file_put_contents('generated.php',$code); # PHP5 function! // Include the generated code for execution include 'generated.php'; ?>

Также интересно, что Ruby (динамический язык в более или менее той же категории, что и Python и Perl) был использован в качестве генератора.