0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.142.55.138


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/stringspliter.php

<?php

	function str_splitf($longString,$maxLineLength)
	{
		$arrayWords = explode(' ', $longString);

		// Max size of each line
		//$maxLineLength = 30;

		// Auxiliar counters, foreach will use them
		$currentLength = 0;
		$index = 0;

		foreach($arrayWords as $word)
		{
			// +1 because the word will receive back the space in the end that it loses in explode()
			$wordLength = strlen($word) + 1;

			if( ( $currentLength + $wordLength ) <= $maxLineLength )
			{
				$arrayOutput[$index] .= $word . ' ';

				$currentLength += $wordLength;
			}
			else
			{
				$index += 1;

				$currentLength = $wordLength;

				$arrayOutput[$index] = $word;
			}
		}
		
		return $arrayOutput;
	}


?>