php,zend-framework,php-extension,php-7
ok answered it to myself :D problem was the **pointer. Final code - did it: zval * params = NULL; zval * t; int i = 0; int arg_num = lua_gettop(L); params = safe_emalloc(sizeof(zval), arg_num, 0); //if(arg_num >= 100) return 0; for (i=0; i<arg_num; i++) { //params[i]=ecalloc(1, sizeof(zval)); //params[i] =...
The comparison operator documentation on php.net defines how comparing different types is handled. Usually some implicit conversion is involved.
The combined comparison operator return -1, 0, or 1, depending on which is greater than the other: if ($x <=> $y == -1) { echo '$x < $y'; } elseif ($x <=> $y == 1) { echo '$x > $y'; } else { echo '$x == $y'; } The null...
Correct, that's one of the limitations of the language. (and the strlen() > 0 anyway can't be checked via a type. That auto-casts to string… so your method allows everything but "", null and false?) Generally, there is RFCs in draft to expand the typehinting of PHP in 7.1: https://wiki.php.net/rfc/union_types...
Sorting algorithm didn't change in PHP 7. Elements are just passed in another order to the sorting algorithm for some performance improvements. Well, benefit could be an eventual faster execution. You really hit worst case when both arrays have completely other keys. Worst case complexity is twice sorting the arrays...
null-coalescing-operator,php-7
I created this which should answer you questions. Anyhow The operator can be chained and it will return the first element in the chain that is set and not null. According to the documentation it will return the result of its first operand if it exists and is not NULL,...
Return types have just been accepted into PHP 7. The return type is part of the function declaration, not its definition. Unless you're making an abstract function or interface, that won't make much difference. Combining your code with what's in that RFC, you would do: class barCl { function _construct()...
php,operators,php-7,spaceship-operator
This <=> operator will offer combined comparison in that it will : Return 0 if values on either side are equal Return 1 if value on the left is greater Return -1 if the value on the right is greater The rules used by the combined comparison operator are same...
Fixed this bug via http://git.php.net/?p=php-src.git;a=commitdiff;h=1d3f77d13d2b457bdf1bc52045da4679741e65cb The mistake was simple... I had in compile time constant resolution optimization set the mode to force succeed or die (a simple boolean to a function call). That mode is needed for static expressions (like const FOO = static::class; must fail). Set that to zero...