note 125076 added to function.http-build-query
| From: | drewdeveloperthomas at gmail dot com | Date: | Wed, 03 Jun 2020 16:52:10 +0000 |
| Subject: | note 125076 added to function.http-build-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214716@lists.php.net to get a copy of this message | ||
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
?>
----
Server IP: 45.112.84.4
Probable Submitter: 103.51.166.36 (proxied: 208.88.249.154)
----
Manual Page -- http://php.net/manual/en/function.http-build-query.php
Edit -- https://master.php.net/note/edit/125076
Del: integrated -- https://master.php.net/note/delete/125076/integrated
Del: useless -- https://master.php.net/note/delete/125076/useless
Del: bad code -- https://master.php.net/note/delete/125076/bad+code
Del: spam -- https://master.php.net/note/delete/125076/spam
Del: non-english -- https://master.php.net/note/delete/125076/non-english
Del: in docs -- https://master.php.net/note/delete/125076/in+docs
Del: other reasons-- https://master.php.net/note/delete/125076
Reject -- https://master.php.net/note/reject/125076
Search -- https://master.php.net/manage/user-notes.php