```<?php
//command that I want to run on remote server
$remoteCmd = "cd /tmp && echo 'Hello world' > ./hello";
$localCmd = ['/usr/bin/ssh', '-o ConnectTimeout=10', 'user@host', $remoteCmd];
echo implode(' ', array_map('escapeshellarg', $localCmd));
// '/usr/bin/ssh' '-o ConnectTimeout=10' 'user@host' 'cd /tmp && echo '\''Hello world'\'' > ./hello'```