update page now

Voting

: eight plus one?
(Example: nine)

The Note You're Voting On

drewdeveloperthomas at gmail dot com
5 years ago
It's not mentioned in the documentation, but when calling http_build_query on an object, public null fields are ignored.

<?php

class A {
    public int $publicNotNull;
    public ?int $publicNull;
    private string $privateNotNull;

    public function __construct()
    {
        $this->publicNotNull = 2;
        $this->privateNotNull = "Test";
    }
}

$a = new A();
echo http_build_query($a); // publicNotNull=2
?>

<< Back to user notes page

To Top