This article mainly introduces the PHP implementation of the removal of multi-array object properties and re-assignment method, involving PHP with the Sphinx operation array elements related implementation techniques, the need for friends can refer to the following
The example in this article describes how PHP implements the removal of multi-array object properties and re-assigns values. Share to everyone for your reference, as follows:
Example: Sphinx The result of a search, to remove an attribute value:
$CL = new Sphinxclient (); $query = $cl->query ($keyword, $index);
Method One, delete the property directly:
foreach ($query [' matches '] as $k = + $val) { unset ($query [' matches '] [$k] [attrs] [content]]; unset ($query [' matches '] [$k] ["Attrs"] ["remarks"]);}
Method Two, set the corresponding attribute value to null or other required value:
foreach ($query [' matches '] as $k + $val) { $query [' matches '] [$k] ["attrs"] [content] = '; $query [' matches '] [$k] ["Attrs"] ["remarks"] = ";}
Note: The key to manipulating multiple arrays is to use as $k in the Foreach Loop and $val to get the subscript for the specific element, otherwise it cannot be manipulated.
another:PHP use Sphinx Search can refer to PHP enable Sphinx Full-Text Search implementation method