You should use `pgrep` to grep the **Process ID** of a process. This is the safest way there is. Some systems(legacy systems) don't have `pgrep` so you'd be forced to use something as `ps`. In case you use `ps` You should consider the following. Your line uses `grep` and `awk` which is not necessary as you could handle all that using awk.
of=$(ps fax | awk '/[p]hp-fpm: master process/{print $1}')
As a side note. Don't use upper case for normal variable names. By convension, Environment variables are CAPITALIZED.
At this stage your variable `$of` will hold the process id of the `php-fpm`. Since your question is not clear, I'm not sure what `expr` is doing there.