-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path09.php
60 lines (48 loc) · 1.41 KB
/
09.php
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
<pre><?php
/*
rail fence cipher
--> 'zig-zag' between the letters of all words
tvifafwawehes hsesoonvtlimaeloemtcagmen irnoerrldony
t
h
i
s
v
e
r
s
i
... and so on
https://en.wikipedia.org/wiki/Rail_fence_cipher
*/
$orig = 'tvifafwawehes hsesoonvtlimaeloemtcagmen irnoerrldony';
$noSpaces = str_replace(' ', '', $orig);
$wordArray = explode(' ', $orig);
$numberOfWords = count($wordArray);
$currentPositionInWord = array();
for($i=0; $i<$numberOfWords; $i++) {
$currentPositionInWord[$i] = 0;
}
$takeFromWord = 0;
$countDirection = 'up';
for($j=0; $j<strlen($noSpaces); $j++) {
echo $wordArray[$takeFromWord][$currentPositionInWord[$takeFromWord]];
$currentPositionInWord[$takeFromWord] ++;
if($takeFromWord == ($numberOfWords-1)) {
$countDirection = 'down';
} elseif($takeFromWord == 0) {
$countDirection = 'up';
}
if($countDirection == 'up') {
$takeFromWord ++;
} else {
$takeFromWord --;
}
}
?>
<hr /><hr />
solution:
this version of novatel firmware allowed me to change my esn
answer to the solution:
1.05
</pre>