if( $$ == $_PARENT_PID ) { # parent } else { # child }