Add a static initialization method to `BcMath\Number`

From: Date: Sat, 23 May 2026 12:50:15 +0000
Subject: Add a static initialization method to `BcMath\Number`
Groups: php.internals 
Request: Send a blank email to internals+get-130989@lists.php.net to get a copy of this message
Hi internals! In this issue, a suggestion was made that it would be convenient if BcMath\Number could be initialized in a callable-style form (i.e. initialized via a static method): https://github.com/php/php-src/issues/22128 Indeed, as pointed out in the issue, similar static methods exist in classes such as DateTime. I am in favor of introducing such a static method. It would probably look something like this: ``` // $scale is optional $num = BcMath\Number::createFrom($val, $scale); ``` It would effectively serve as an alias for the constructor. Incidentally, since this does not introduce any BC break, I do not believe an RFC is necessary. I would like to hear everyone’s thoughts on this. Regards, Saki

« previous php.internals (#130989) next »