请帮助比较两个字符串,并以百分比的形式区分它们
我有两个字符串:
first string:
253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,253.0.0.0,247.0.0.24,197.0.0.35,189.0.0.98....
second string:
255.255.255.127,255.255.255.127,255.255.255.127,255.255.255.127,255.255.255.127,255.255.255.127,255.255.255.127,255.255.255.127,255.255.255.127....
$first_array = explode(",", $out_string);
$second_array = explode(",", $out_string_1);
$result_array = array_merge(array_diff($first_array, $second_array), array_diff($second_array, $first_array));
$result = implode(",",$result_array);
echo $result;
Run Code Online (Sandbox Code Playgroud) 请帮我计算图像中的像素数,或者输出RGB数组.
所以这是脚本给我一个来自数组的元素:
<?php
$img = "1.png";
$imgHand = imagecreatefrompng("$img");
$imgSize = GetImageSize($img);
$imgWidth = $imgSize[0];
$imgHeight = $imgSize[1];
echo '<img src="'.$img.'"><br><br>';
for ($l = 0; $l < $imgHeight; $l++) {
for ($c = 0; $c < $imgWidth; $c++) {
$pxlCor = ImageColorAt($imgHand,$c,$l);
$pxlCorArr = ImageColorsForIndex($imgHand, $pxlCor);
}
}
print_r($pxlCorArr);
?>
Run Code Online (Sandbox Code Playgroud)
对不起我来自乌克兰的英语
请帮我转换数组到字符串.
数组看起来像这样:
Array
(
[0] => Array
(
[0] => Array
(
[red] => 255
[green] => 255
[blue] => 255
[alpha] => 127
)
[1] => Array
(
[red] => 255
[green] => 255
[blue] => 255
[alpha] => 127
)
...
)
)
Run Code Online (Sandbox Code Playgroud)
我试图使用implode函数,但没有结果......
$string = implode(", ", $pxlCorArr);
Run Code Online (Sandbox Code Playgroud)
PS:对不起我来自乌克兰的英语.