I need to do what the subject title says, the detail is that it is an array that has a maximum size of 10, so I don't know when they will enter a different size, that is, 10 is not mandatory, but if it is the maximum, I am new to the language.
Go to the end of the code:
<?php
function sevent(int $c){
if(($c/7)>17)
return true;
else
return false;
}
function sprimo(int $b){
$d=1; $p=0;
do{
if($b % $d == 0)
$p++;
$d++;
}while($d < $b+1);
if($p==2)
return true;
else
return false;
}
function lenner(string $a)
{
$sz = strlen($a);
$vector;
$cat;
$b;
$i;
$x;
for($i=0; $i<$sz; $i++)
$vector[$i]=ord($a[$i]);
for($i=0; $i<$sz; $i++){
$x=$vector[$i];
if(sprimo($x)){
$vector[$i]+=5;
$cat[$i]=1;
goto jump;
}
if(sevent($x)){
$vector[$i]-=7;
$cat[$i]=2;
goto jump;
}
else{
$vector[$i]+=9;
$cat[$i]=3;
}
jump:
}
for($i=0; $i<$sz; $i++)
$b[$i]=chr($vector[$i]);
$sub2 = $b[0] . $b[1] . $b[2] . $b[3] . $b[4] . $b[5] . $b[6] . $b[7] . $b[8] . $b[9] ;
return $sub2;
}
A million thanks
Use the sizeOf() function
The simple solution to this is to loop the array size and values to avoid only handling the 10 you mention.
This at the end of your code. Likewise, each character in the array
$b
will be emulated as a string and added to your$variable
.Thank you all for helping me, I changed the conditions for my encryption function, the answer to my question is this: