Giter Site home page Giter Site logo

doc-zh's People

Contributors

atlanticf avatar big-dream avatar bjori avatar bolechen avatar chrisdowson avatar cmb69 avatar codinglist avatar girgias avatar haytoo avatar her-cat avatar hytest avatar jader avatar jhdxr avatar kallez avatar laruence avatar mowangjuanzi avatar mozafish avatar neeke avatar nilgun avatar philip avatar shiny avatar sobak avatar sy-records avatar twose avatar vrana avatar wowo-zz avatar yaowenqiang avatar zhonglangjp avatar zhoumengkang avatar zzfly256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doc-zh's Issues

ksort sorting is inconsistent

From manual page: https://php.net/function.ksort


php7

$data = [ "user_id" => 1, "0"=>1 ]; 
ksort($data);
var_dump($data);

result:

array(2) {
  'user_id' =>int(1)
  [0] =>int(1)
}

php8:

$data = [ "user_id" => 1, "0"=>1 ]; 
ksort($data);
var_dump($data);

result:

array(2) {
  [0] =>int(1)
  'user_id' => int(1)
}

example function importer issue

From manual page: https://php.net/generator.send


Example (note the handling of null, which you would send to the generator to handle stragglers after the previous batch)

function importer()
{
  $max = 500;
  $items = [];
  while (true) {
    $item = yield;
    if ($item !== null) {
      $items[] = yield;  //$item instead of yield,otherwise the $items will always have one item
    }
    if ($item === null || count($items) >= $max) {
       // do batch operations
       $items = [];
    }
  }
}

bugbugbugbug

From manual page: https://php.net/function.call-user-func-array

---Uncaught Error: Cannot use positional argument after named argument
8之前的版本都是正常的,call_user_func_array 一个callback,一个array,哪来的positional argument!你们眼瞎还是心瞎了?乱改锤子呢!休你仙人了!**

trait代码复用机制问题

From manual page: https://php.net/language.oop5.traits
trait代码复用机制问题

代码正常

<?php

class A
{
    protected static $instance = null;

    public static function getInstance(...$args)
    {
        if(!isset(self::$instance)){
            self::$instance = new static(...$args);
        }
        return self::$instance;
    }

    public function getB()
    {
        return B::class::getInstance();
    }
}

class B extends A
{
    protected static $instance = null;

    public static function getInstance(...$args)
    {
        if(!isset(self::$instance)){
            self::$instance = new static(...$args);
        }
        return self::$instance;
    }
}
var_dump(A::getInstance()->getB()); // B

代码复用不正常

<?php

trait Singleton
{
    protected static $instance = null;

    public static function getInstance(...$args)
    {
        if(!isset(self::$instance)){
            self::$instance = new static(...$args);
        }
        return self::$instance;
    }
}

class A
{
    use Singleton;

    public function getB()
    {
        return B::class::getInstance();
    }
}

class B extends A
{
    use Singleton;
}
var_dump(A::getInstance()->getB()); // A

options 和 longopts 应为 short_options 和 long_options

From manual page: https://php.net/function.getopt

原文:

Note:
The format for the short_options and long_options is almost the same, the only difference is that long_options takes an array of options (where each element is the option) whereas short_options takes a string (where each character is the option).

中文 (当前):

注意:
options 和 longopts 的格式几乎是一样的,唯一的不同之处是 longopts 需要是选项的数组(每个元素为一个选项),而 options 需要一个字符串(每个字符是个选项)。

options 和 longopts 应为 short_options 和 long_options

doc and php runtime error

From manual page: https://php.net/functions.arguments


php-src in /ext/standard/basic_functions.stub.php line 132

the second name is count, but php runtime and doc is num.

php-src:
function array_fill(int $start_index, int $count, mixed $value): array {}

doc-zh:

<?php
array_fill(value: 50, num: 100, start_index: 0);
?>

touch时间戳问题

From manual page: https://php.net/function.touch

touch在win10环境下,先复制文件后,修改文件最后修改日期,结果修改后文件的实际时间戳多1秒。这个问题是在文件同步到U盘的情况下出现的,在系统磁盘之间无问题。

$dfile ='D:\touch_test\100.txt';
$efile ='E:\upan_disk\100.txt';

$dfile =str_replace('\', '/', $dfile);
$efile =str_replace('\', '/', $efile);

$mt_from =filemtime($dfile);

var_dump( 'dfile: '. $mt_from );
var_dump( 'efile: '. filemtime($efile) );

$stat =copy($dfile, $efile);
var_dump( $stat );

$stat =touch($efile, $mt_from);
var_dump( $stat );

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.