I get the error “Fatal error: Call to undefined function: str_split()” when I try to split a string. Here is the code:
[CODE]$filesstring = getfiles(); $filesarray = str_split($filesstring);[/CODE]
What’s my problem?
[CODE]<? // getfiles() function thanks to http://www.codingforums.com/showthread.php?t=71869 function getfiles($dirname=".") { $pattern="(.html$)"; $files = ""; if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))){ if(eregi($pattern, $file)) { $tempfiles = "$files $file"; echo "$tempfiles ||||| "; $files = $tempfiles; } } closedir($handle); } return($files); } $filesstring = getfiles(); $filesarray = str_split($filesstring); echo getfiles(); echo $filesstring; echo $filesarray; ?>[/CODE]
Help @shane_carr spread the word by sharing this article on Twitter...