1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
| <?php
echo "je suis '".$_SERVER['SCRIPT_FILENAME']."'";
echo "<br>\n";
echo "<br>\n";
function affiche_variable($v) {
echo "'<u>".$v."</u>'<br>";
}
function affiche_variable_avec_position($v) {
#echo "début fonction affiche_variable_avec_position()";
echo "<tt><u>'".$v."'<br>'";
for ($i=0;$i<strlen($v);$i++) {
echo $i%10;
}
echo "'<br>\n'";
for ($i=0;$i<strlen($v);$i++) {
if ($i%10==0) {
echo $i/10;
} else {
echo "-";
}
}
echo "'<br>\n'";
for ($i=0;$i<strlen($v);$i++) {
echo (strlen($v)-$i-1)%10;
}
echo "'<br>\n'";
for ($i=0;$i<strlen($v);$i++) {
if ((strlen($v)-$i-1)%10==0) {
echo (strlen($v)-$i-1)/10;
} else {
echo "-";
}
}
echo "'</u><br></tt>\n";
#echo "fin fonction affiche_variable_avec_position()";
}
/*
echo "test de 'affiche_variable_avec_position()'";
echo "<br>\n";
$v="01234567890-2-4-6-8-0-dfgjsdlkgmsngkjsndfkgnserkjngfmoqehjrqezhrmnhesrgftserngsjrntgjknfdskgnjf";
affiche_variable_avec_position($v);
echo "<br>\n";
*/
function affiche_variable_pt($v) {
#echo "début fonction affiche_variable_pt()";
echo "<br>\n";
// ajoute "<br>" à chaque point+espace rencontré
for ($i=0;$i<strlen($v);$i++) {
$c=substr($v,$i,1);
#affiche_variable($c);
$c2=substr($v,$i,2);
#affiche_variable($c2);
if (($c==chr(10)) || $c2==". " || $c2==": " || $c2=="; ") {
echo $c."<br>";
} else {
echo $c;
}
}
echo "<br>\n";
#echo "fin fonction affiche_variable_pt()";
#echo "<br>\n";
}
function affiche_variable_avec_br($v) {
echo "<br>\n";
// change les "<br>" en "< br >"
$sv=strlen($v);
for ($i=0;$i<$sv;$i++) {
$c4=substr($v,$i,4);
#affiche_variable($c4);
$c1=substr($v,$i,1);
#affiche_variable($c1);
if (($c1==chr(10))) {
print "_^^^^__".substr($v,0,$i-1)."\\\\";
print '\\ n---';
echo '\\ n---';
print_r('\\ n---');
echo 'eeeeeeeeeee';
print_r('ffffffffffffff');
echo 'zzzz'.substr($v,$i+1,$sv)."######<br>";
} else {
#echo $c1;
}
}
echo "<br>\n";
}
function executer($r,$text) {
//echo "début fonction executer";
//echo "<br>\n";
affiche_variable_avec_position($text);
affiche_variable($r);
echo "'".eval($r)."'";
$w=eval($r);
affiche_variable_avec_br($w);
echo "<br>\n";
//echo "fin fonction executer";
//echo "<br>\n";
}
function executer2($r,$text,$replace,$length) {
//echo "début fonction executer";
//echo "<br>\n";
//affiche_variable_avec_position($text);
affiche_variable($r);
echo eval($r);
echo "<br>\n";
//echo "fin fonction executer";
//echo "<br>\n";
}
function executer3($r,$day,$month,$year) {
//echo "début fonction executer";
//echo "<br>\n";
//affiche_variable_avec_position($text);
affiche_variable($r);
echo "'".eval($r)."'";
echo "<br>\n";
//echo "fin fonction executer";
//echo "<br>\n";
}
function executer_dump($r,$foo) {
echo "début fonction executer_dump()";
echo "<br>\n";
//affiche_variable($foo);
affiche_variable($r);
echo $z;
var_dump(eval($r));
echo $z;
echo "<br>\n";
echo "fin fonction executer_dump()";
echo "<br>\n";
}
function affiche_tableau($e) {
for ($i=0;$i<count($e);$i++) {
echo $i." : '<u>".$e[$i]."</u>', ";
}
echo "<br>\n";
echo "<br>\n";
}
function affiche_tableau_associatif($t) {
$max=200;
reset($t);
$j=0;
while (list($indice,$valeur)=each($t)) {
$j++;
echo "'$indice'=> '$valeur'<br>";
#echo "'$indice'=> '$valeur', ";
$max=500;
if ($j>$max) {
echo "arret boucle !!! : plus de $max éléments !!!";
return $j;
}
}
}
/*
for ($i=0;$i<count($e);$i++) {
echo $i." : '<u>".$e[$i]."</u>', ";
}
echo "<br>\n";
echo "<br>\n";
executer(
executer_dump($
affiche_tableau(
affiche_tableau_associatif(
affiche_variable(
affiche_variable_avec_position($
affiche_variable_pt(
echo "<br>\n";
*/
#==================================== fonction vfprintf($handle, '%f', $args)=========================================================================
$a='string wordwrap ( string $str [, int $width = 75 [, string $break = \"\n\" [, bool $cut = false ]]] )';
affiche_variable_pt($a);
echo "<br>\n";
echo "<br>\n";
$text = "Portez ce bouquet de fleurs à la femme au décoleté.";
affiche_variable($text);
$b='$newtext = wordwrap($text, 20, "<br />\n");return $newtext;';
executer($b,$text);
$b='$newtext = wordwrap($text, 10, "<br />\n");return $newtext;';
executer($b,$text);
$b='$newtext = wordwrap($text, -5, "<br />\n");return $newtext;';
executer($b,$text);
?> |
Partager