TestLanguage.php 642 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. class TestLanguage extends TestCase
  4. {
  5. public function testYield()
  6. {
  7. $checker = function ($val) {
  8. return $val > 5 ? true : false;
  9. };
  10. $map_adder = function ($datas,$delta)
  11. {
  12. foreach ($datas as $val) {
  13. $k = yield $val + $delta;
  14. }
  15. };
  16. $datas = [1,2,3,4,5,6];
  17. $x = $map_adder($datas,2);
  18. foreach ($x as $v) {
  19. $t = $checker($v);
  20. }
  21. }
  22. public function testStrtolow()
  23. {
  24. $val = '';
  25. $val = null;
  26. $k = strtolower($val ?? '');
  27. }
  28. }