0
두 가지 질문이 있습니다 : 1. 시작 문자열과 끝 문자열을 사용하여 문자열을 배열로 나누는 방법으로 배열 요소를 모두 inbetween에서 제거합니다. 2. 새 배열을 다른 배열과 비교하고 요소가 일치하면 사용자가 일치하는 값을 알 수 있습니다.문자열 배열을 만들어 다른 배열과 비교하십시오.
은 내가 MAC 주소의 값을 필요 배열로 문자열의 내용을 깰 필요가
[MAC]
mac=12EG23OCSOPC
mac=111111111111
mac=222222222222
mac=333333333333
나는 "= 맥"후 모든 값을 필요로하고 \ n을 이전
그리고 나서이 값을 다른 배열과 비교해야합니다. 동일한 항목이있는 경우 사용자에게 일치하는 항목을 알려줘야합니다. 이것은 내가 지금까지 가지고있는 것입니다.
function count_compare_macs($macs_to_compare, $new_array)
{
$macs_to_compare_count = count($macs_to_compare);
$new_array_count = count($new_array);
if(($macs_to_compare_count + $new_array_count) >= 5)
{
return false;
$error_message="You already have 5 MAC address in your system";
}else{
//here is where i need to compare the two arrays and if any are the same say false and set the error message.
$compare_arrays = array_Diff($macs_to_compare,$new_array)
if (!$compare_arrays){
return true;
}else{
//here is where i need to compare the two arrays and if any are the same say false and set the error message.
$error_message= "The following mac is already used" . $match
return false;
}
}
}
도움을 주셔서 감사합니다. 나는 성냥에 기초를 두는 새로운 배열을 만드는 경우에 결코 생각하지 않는다. 매우 도움이됩니다. – Denoteone
아무 문제 없음^_^언제든지 – Neal