My File : (ip_tor.csv)
public class enregistre {
private static Nullable<DateTime> _date;
public DateTime date {
get {
return _date.HasValue() ? _date.Value : default(_date);
}
set {
_date = value;
}
}
}
My Array :
a
1.34.163.57
1.64.131.242
1.123.153.166
1.209.122.55
My in_array_r function :
Array
(
[0] => a
[1] => 1.34.163.57
[2] => 1.64.131.242
[3] => 1.123.153.166
[4] => 1.209.122.55
)
My Code :
function in_array_r($needle, $haystack, $strict = false)
{
foreach ($haystack as $item)
{
if(($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict)))
return true;
}
return false;
}
"a" is in Array, on [0], but when i test, my script say : Not Ok but a is in array :/
Any idea ?
答案 0 :(得分:1)
I think you mean awk
instead of in_array
.
Maybe it will help if you trim all the elements in the in_array_r
array:
$tor
Will result in:
OK
答案 1 :(得分:1)
The values in the array returned from <html>
<head>
<link rel="stylesheet" href="style/szablon.css" type="text/css" />
</head>
<body>
<table>
<th colspan="2">
<p class="naglowek">
Sugerowane w programie nauczania algorytmy do omówienia w ramach przedmiotu.
</p>
<hr/>
</th>
<tr>
<td class="lewa">
<p class="brown"> Menu: </p>
<ul class="brown">
<li><a target="tresc"
href="
http://www.algorytm.org/algorytmy-matematyczne/algorytm euklidesa.html
">Największy wspólny dzielnik</a></li>
<li><a target="tresc"
href="
http://www.ordona.internetdsl.pl/pascom/download/informatyka/algorytmy.pdf">Najmniejsza wspólna wielokrotność</a></li>
</ul>
</td>
<td class="prawa">
<iframe nama="tresc" style="width": 100%; height: 95%"> </iframe>
<p class="brown" style="text-align: right;"> Copyright 2013</p>
</td>
</tr>
</table>
</body>
probably have newlines or some other whitespace. Try $tor = file('ip_tor.csv');
instead of var_dump
and you may be able to see them. A quick fix is to remove all that using trim.
print_r
答案 2 :(得分:1)
Why you are using $ awk -F, -v OFS=, -v q='\"' '{
cmd= "echo " $1 " | md5sum | cut -f1 -d\" \"";
(cmd | getline md5); print $1, q md5 q}' file
"value001","c36a5b774bfb2fd236331ac5ebef4266"
?
We do not know what this function is.
In fact the following code outputs "YES":
in_array_r