Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $numbers = array(53.27219 ,53.10959 ,52.94684 ,52.78391 ,52.62078
- ,52.45744 ,52.29386 ,52.13 ,51.96584 ,51.80133 ,51.63642 ,51.47107 ,51.30519 ,51.13872
- ,50.97154 ,50.80353 ,50.63453 ,50.46435 ,50.29274 ,50.11935 ,49.94374 ,49.76532
- ,49.58325 ,49.39632 ,49.20276 ,48.99983 ,48.78312 ,48.54514 ,48.27245 ,47.9406
- ,47.51787 ,46.98374 ,46.30088 ,45.34415 ,43.70032 ,40.38476 ,34.11288 ,24.58026
- ,12.87396 ,0.219008 ,-12.751 ,-25.8118 ,-38.8813 ,-51.8813 ,-64.6077 ,-76.4788 ,-86.3479 ,-
- 93.1662 ,-97.1914 ,-99.6282 ,-101.403 ,-102.901 ,-104.236 ,-105.44 ,-106.519 ,-107.441 ,-
- 108.099 ,-108.315 ,-108.007 ,-107.299 ,-106.363 ,-105.293 ,-104.111 ,-102.809 ,-101.353 ,-
- 99.6144 ,-97.1804 ,-93.1542 ,-86.5742 ,-77.5024 ,-66.9783 ,-55.9228 ,-44.7659 ,-33.6655 ,-
- 22.7078 ,-12.0465 ,-2.16749 ,5.596392 ,8.953605 ,6.409632 ,-0.87122 ,-10.5532 ,-21.1423 ,-
- 32.0684 ,-43.1543 ,-54.3139 ,-65.4137 ,-76.1186 ,-85.6619 ,-92.8141 ,-96.6372 ,-97.5276 ,-
- 96.8456 ,-95.6864 ,-94.4844 ,-93.2892 ,-92.0474 ,-90.7437 ,-89.4553 ,-88.344 ,-87.5706 ,-
- 87.1008 ,-86.4368 ,-84.4731 ,-79.7794 ,-71.3296 ,-59.1578 ,-44.4565 ,-29.2102 ,-15.6416 ,-
- 5.46076 ,0.903399 ,4.35291 ,6.237021 ,7.487215 ,8.449697 ,9.134153 ,9.448294 ,9.276234
- ,8.410266 ,6.415044 ,2.740944 ,0.903399 ,4.35291 ,6.237021 ,7.487215 ,8.449697
- ,9.134153 ,9.276234 ,8.410266 ,6.415044 ,2.740944 ,0.903399, -2.6511 ,-9.06238 ,-15.7684
- ,-22.4422 ,-29.0107 ,-35.4879 ,-41.93 ,-48.4198 ,-54.9181 ,-60.7777 ,-64.2487 ,-63.3878 ,-
- 57.9984 ,-49.5176 ,-39.447 ,-28.7147 ,-17.855 ,-7.31229 ,2.28053 ,9.885485 ,14.29327
- ,15.14748 ,13.47304 ,10.62232 ,7.356688 ,3.939311 ,0.45589 ,-3.00618 ,-6.20513 ,-8.55388
- ,-9.25998 ,-8.09212 ,-5.69937 ,-2.93759 ,-0.37243 ,1.671892 ,2.884461 ,2.727444 ,0.28318
- ,-5.57111 ,-15.4768 ,-28.7477 ,-43.1527 ,-55.6418 ,-63.5747 ,-65.8155 ,-63.0848 ,-57.2701 ,-
- 50.2576 ,-43.2142 ,-36.5727 ,-30.3353 ,-24.3377 ,-18.3926 ,-12.3611 ,-6.18032 ,0.153234
- ,6.619063 ,13.17661 ,19.69365 ,25.79519 ,30.81346 ,34.18413 ,35.98827 ,36.79111
- ,37.09688 ,37.15755 ,37.05811 ,36.81298 ,36.39788 ,35.7003 ,34.34804 ,31.5164 ,26.29645
- ,18.71088 ,9.715393 ,0.177027 ,-9.49762 ,-19.1638 ,-28.7514 ,-38.1497 ,-47.0191 ,-54.4243
- ,-58.7291 ,-58.8152 ,-55.463 ,-50.3447 ,-44.5505 ,-38.5009 ,-32.3263 ,-26.0857 ,-19.8645 ,-
- 13.8857 ,-8.65529 ,-4.83797 ,-2.62424 ,-1.50655 ,-0.89118 ,-0.47028 ,-0.13983 ,0.129811
- ,0.349844 ,0.533673 ,0.69606 ,0.845594 ,0.986988 ,1.122951 ,1.255128 ,1.38457 ,1.511976
- ,1.637826 ,1.762463 ,1.886135 ,2.00903 ,2.131288 ,2.253018 ,2.374305 ,2.495219
- ,2.615814 ,2.736134 ,2.856217 ,2.976092 ,3.095786 ,3.21532 ,3.334712 ,3.453977 ,3.57313
- ,3.692181 ,3.811141 ,3.930019 ,4.048821 ,4.167556 ,4.286228 ,4.404843 ,4.523406
- ,4.641922 ,4.760393 ,4.878823 ,4.997215 ,5.115573 ,5.233898 ,5.352192 ,5.470459
- ,5.588699 ,5.706914 ,5.825107 ,5.943277 ,6.061428 ,6.179559 ,6.297673 ,6.415769
- ,6.53385 ,6.651915 ,6.769966 ,6.888004);
- function rendez(array $array)
- {
- $output = [];
- $positive = ($array[0] <= 0)?false:true;
- for($i = 0; $i < count($array); $i++)
- {
- if($array[$i] >= 0)
- {
- if($positive == true)
- {
- array_push($output, [$array[$i]]);
- $positive = false;
- }
- else
- {
- $length = count($output)-1;
- $temparray = $output[$length];
- $temparray[] = $array[$i];
- $output[$length] = $temparray;
- }
- }
- else if($array[$i] < 0)
- {
- if($positive == false)
- {
- array_push($output, [$array[$i]]);
- $positive = true;
- }
- else
- {
- $length = count($output)-1;
- $temparray = $output[$length];
- $temparray[] = $array[$i];
- $output[$length] = $temparray;
- }
- }
- }
- return $output;
- }
- print '<pre>';
- var_dump( rendez($numbers) );
- print '</pre>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement