codeplex:PHP LINQ classes,PHP也可以使用Linq语法操作对象
来源:互联网 发布:尔雅网络课程登录入口 编辑:程序博客网 时间:2024/05/16 09:24
Examples can be found in the test package in the latest release.
A basic example
Let's say we have an array of strings and want to select only the strings whose length is < 5. The PHPLinq way of achieving this would be the following:// Create data source$names = array("John", "Peter", "Joe", "Patrick", "Donald", "Eric"); $result = from('$name')->in($names) ->where('$name => strlen($name) < 5') ->select('$name');
Feels familiar to SQL? Yes indeed! No more writing a loop over this array, checking the string's length, and adding it to a temporary variable.
You may have noticed something strange... What's that $name => strlen($name) < 5 doing? This piece of code is compiled to an anonymous function or Lambda expression under the covers. This function accepts a parameter $name, and returns a boolean value based on the expression strlen($name) < 5. (待续...)
转载地址:http://www.weiqinxue.cn/blogs/index.php/User/articleview/ArticleID/U2A15
0 0
- codeplex:PHP LINQ classes,PHP也可以使用Linq语法操作对象
- PHP中的Linq-用SQL语法操作PHP数组
- 光脚丫学LINQ(015):使用LINQ to SQL可以执行的操作
- (015):使用LINQ to SQL可以执行的操作
- LINQ语法
- LINQ语法
- Linq语法
- Linq语法
- linq语法
- Linq 语法
- Linq语法
- Linq语法
- PHP也可以当成Shell Script使用
- LINQ to SQL 中可以使用的LINQ函式
- 使用Linq操作XML数据
- linq操作
- 数组为什么可以使用linq查询
- Linq to SQL 语法及使用
- 一部分字符串库函数的实现
- MyEclipse导入maven项目下载不了jar的问题
- 理解 select 函数并实现服务器端
- 工作中的英语积累4
- 初学Lua
- codeplex:PHP LINQ classes,PHP也可以使用Linq语法操作对象
- 解析JSON将数据存入sqlserver数据库中
- axure中继器的使用
- 回调函数教程(二):Android中ListView点击事件回调实例
- Openfire3.9.3源代码导入eclipse中开发配置指南
- 一个农夫的故事
- leetcode 矩阵旋转
- 2015-1-24
- Android 软键盘弹起隐藏的监听