Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Send a raw HTTP header
header(string $headerbool $replace trueint $response_code 0): void
if (isset($_GET['img'])) {

    
$fp fopen('https://bref.sh/img/logo-small.png''rb');

    
header('Content-Type: image/png');

    
fpassthru($fp);

    exit(
0);

}
}



if (isset(
$_GET['json'])) {

    
header('Content-Type: application/json');

    echo 
json_encode(['Hello' => '🌍']);

    exit(
0);

}
}



if (isset(
$_GET['weird'])) {

    
header('Content-Type: foo/bar');

    echo 
'Hello 🌍';

    exit(
0);

}
<?php declare(strict_types=1);



if (
$_GET['extensions'] ?? false) {

    
header('Content-Type: application/json');

    echo 
json_encode(get_loaded_extensions(), JSON_PRETTY_PRINT);

    return;

}
}



if (
$_GET['php-config'] ?? false) {

    
header('Content-Type: application/json');

    echo 
json_encode(ini_get_all(nullfalse), JSON_PRETTY_PRINT);

    return;

}
}



if (
$_GET['env'] ?? false) {

    
header('Content-Type: application/json');

    echo 
json_encode([

        
'$_ENV' => $_ENV['FOO'] ?? null,

        
'$_SERVER' => $_SERVER['FOO'] ?? null,
<?php declare(strict_types=1);



header('Content-Type: application/json');



echo 
file_get_contents(__DIR__ '/big-json.json');
<?php declare(strict_types=1);



header('Content-Type: application/json');



echo 
json_encode([

    
'$_GET' => $_GET,
<?php declare(strict_types=1);



header('Content-Type: application/json');



header('X-MultiValue: foo');

header('X-MultiValue: bar'false);
header('Content-Type: application/json');



header('X-MultiValue: foo');

header('X-MultiValue: bar'false);



echo 
json_encode([
header('Content-Type: application/json');



header('X-MultiValue: foo');

header('X-MultiValue: bar'false);



echo 
json_encode([

    
'data' => 'Hello world!',
<?php declare(strict_types=1);



if (
$_GET['extensions'] ?? false) {

    
header('Content-Type: application/json');

    echo 
json_encode(get_loaded_extensions(), JSON_PRETTY_PRINT);

    return;

}
}



if (
$_GET['php-config'] ?? false) {

    
header('Content-Type: application/json');

    echo 
json_encode(ini_get_all(nullfalse), JSON_PRETTY_PRINT);

    return;

}
}



if (
$_GET['env'] ?? false) {

    
header('Content-Type: application/json');

    echo 
json_encode([

        
'$_ENV' => $_ENV['FOO'] ?? null,

        
'$_SERVER' => $_SERVER['FOO'] ?? null,