The following returns Warning: range() expects at least 2 parameters, 1 given.
Can’t figure it out. Suggestions most welcome.
**<?php
echo acct_type(110);
function acct_type($acct_no)
{ $sections = array(
'Current Asset' => '100,149',
'Fixed Asset' => '150,159',
'Accumulated Depreciation' => '160,169',
'Current Liability' => '200,249',
'Long Term Liability' => '250,299',
'Equity' => '300,399',
'Revenue' => '400,499',
'Cost of Goods Sold' => '500,599',
'Expense' => '600,699'
);
foreach($sections as $section => $range)
{ if(in_array($acct_no, range($range))) return $section;
}
}
?>**
range()requires two arguments http://php.net/manual/en/function.range.phpIn your program you take a string that contains a text with comma inside.
You need to split the string and use the result in your
range()function