bashブレースの拡張を実現するPHPの方法はありますか?例えばPHPのBashブレース拡張?
<?php
echo brace_expand("{hello,hi,hey} {friends,world}");
//hello friends, hello world, hi friends, hi world, hey friends, hey world,
よう
[[email protected] ~]$ echo {hello,hi,hey}\ {friends,world},
hello friends, hello world, hi friends, hi world, hey friends, hey world,
何かが現在、私は
<?php
echo shell_exec("echo {hello,hi,hey}\ {friends,world}");
を使用しています。しかし、それについて移動する(そしておそらく上で動作しません正しい方法のように見えるしていません。 Windowsサーバー)
注:これはちょうど実行中のコマンドグループに関連するものなど、中括弧拡張の他の機能ではなく、文字列を出力するユースケース。
入れ子にされたループを使うことはできますか?私はこれを行う組み込みのPHP関数を知らない。 –
@CharlotteDunoisネストされたループについて考えましたが、bashが任意の数のブレース式を処理できるのに対して、ブレース式の数は事前に知っていなければならないようです。 – chiliNUT
テキストを印刷するだけですか? – MoeinPorkamel