Jump to content

[SOLVED] array_pop


mtylerb

Recommended Posts

Is there something that is more efficient than array_pop?  I'm currently using it like:

 

<?php
private function trimc($limit)
{
	while (count($this->children) != $limit)
	{
		array_pop($this->children);
	}
}
?>

 

The code is used to trim the end results off an array which is the result of multiple arrays being combined together and sorted.  My method seems rather inefficient and was the only way that I could think of doing it.  The array that I'm wanting to trim is an array of PageArchive Objects.

Link to comment
https://forums.phpfreaks.com/topic/130647-solved-array_pop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.