Voting

: six plus two?
(Example: nine)

The Note You're Voting On

drewdeveloperthomas at gmail dot com
4 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