[lang-ref] ( get_command_return_code ) ( php )

<?php
public function testGetCommandReturnCode(): void
{
	// exec($output, $status)

	$output = [];
	$status = 0;

	exec('ls -l /etc/hosts > /dev/null', $output, $status);
	$this->assertSame(0, $status);

	exec('ls -l /no/such/file 2>/dev/null', $output, $status);
	$this->assertSame(1, $status); // this depends on command
}