Skip to content

Instantly share code, notes, and snippets.

@caionorder
Last active August 28, 2019 20:55
Show Gist options
  • Save caionorder/d9fba6b2c8d1abd33e800e93027e4f59 to your computer and use it in GitHub Desktop.
Save caionorder/d9fba6b2c8d1abd33e800e93027e4f59 to your computer and use it in GitHub Desktop.
<?php
function implodador($string, $insere = "<!--nextpage-->", $intervalo = 400){
$local_insere = $intervalo;
$contadorFull = strlen($string);
$contadorSemHtml = 1;
$flag = 0;
$textExemplo = str_split($string);
foreach( $textExemplo as $letter ){
$letter." = ".$contadorSemHtml."";
if($letter == '<')
$pausa = true;
else if($letter == '>')
$pausa = false;
if(!$pausa)
$contadorSemHtml++;
$newText[] = $letter;
if($contadorSemHtml == $local_insere){
$flag = 1;
$local_insere = $local_insere+$intervalo;
}
if($flag == 1 && $letter == "." ){
$newText[] = $insere;
$flag = 0;
}
}
return implode('', $newText);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment