Hello, I need help with php. Found such code:

<?php function pc_permute($items, $perms = array( )) { if (empty($items)) { print join(' ', $perms) . "<br>"; } else { for ($i = count($items) - 1; $i >= 0; --$i) { $newitems = $items; $newperms = $perms; list($foo) = array_splice($newitems, $i, 1); array_unshift($newperms, $foo); pc_permute($newitems, $newperms); } } } print_r(pc_permute(array('1', '2', '3', '4', '5', '6', '7', '8', '9', '0'))); ?> 

Please help me finish so that you can set a limit of, for example, 3 characters (so that it is approximately 123/567/739) and so that for example it can save to a file.txt, and then the computer thinks for a long time and has little memory. Thank you in advance.

  • Why do you need these 3 characters, if you get just numbers from 100 to 999, which you can enter? - NTP

1 answer 1

You can save it like this.

  $file = fopen("Путь_к_файлу.txt", w); fwrite($file, "Текст_который_нужно_записать"); fclose($file);