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: // Crea
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
// Create data source
$names = array("John", "Peter", "Joe", "Patrick", "Donald", "Eric");
$result = from('$name')->in($names)
->where('$name => strlen($name) 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)
http://www.weiqinxue.cn/blogs/index.php/User/articleview/ArticleID/U2A15
Kenyataan:Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn