首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > PHP > Python列表解析PHP的启发

Python列表解析PHP的启发

  • 资源大小:3.55 kB
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签: php python 解析 启发 列表

资 源 简 介

With php-lc you can easily manipulate your PHP arrays in style of Python list comprehensions. Python syntax: [i*2 for i in Data if i > 5] php-lc syntax: lc ("$i*2 for $i in $Data if $i > 5", compact ("Data")) php-lc examples Example 1. Experimenting with powers. $Foo = array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);print_r (lc ("pow ($i, 2) for $i in $Foo if $i % 2", compact ("Foo")));--Array( [0] => 1 [1] => 9 [2] => 25 [3] => 49 [4] => 81) Example 2. Calculating years to pension for male employers. $Foo = array ( array ("name" => "Sam", "age" => 53, "sex" => "m"), array ("name" => "Joe", "age" => 51, "sex" => "m"), array ("name" => "Bill", "age" => 58, "sex" => "m"), array ("name" => "Lisa", "age" => 51, "sex" => "w"),);print_r (lc ("$Person["nam

文 件 列 表

php-lc
ListComprehension.php

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP