Limit is ignored in civicrm_api3('Membership', 'get')
You need to use options.limit to make this work.


  options.limit : The maximum number of records to return. You can make this unlimited by setting the value to 0.


Usage

$result = civicrm_api3('Membership', 'get', array(
  'membership_type_id' =&gt; "$level",
  'options' =&gt; array('limit' =&gt; 1000),
));


Get more details on the different parameters you can use under options.

Also check : How do I get more than 25 records from the API?