PHP in_arrayマニュアルを読み、いくつかのコード行を作成します。
$handle = fopen("/path/to/file", "a") or die('Cannot open file:');
$y= $command_name1.$steps1;
$x=trim(shell_exec("grep -ri -o '$y' /path/to/file "));
$Z=array($x);
if (in_array($y,$z,false))
{
echo "thise 2 variables are already in this file";
fclose($handle);
}
else {
//write some thing on that file
}
しかし、これにより上記のエラーが発生します。そして、私が知りたいのは、2 つの変数 ($command_name1
と$steps1
) を一緒に追加して検索できるin_array
かどうかです。