attachment
. В этом поле просто через запятую идут строки типа photo-123_456
, идентифицирующие прикладываемые картинки.public function msgSend($msg, $uid, $token, $attachment = '' ){
$request_params = array(
'message' => $msg,
'user_id' => $uid,
'attachment' => $attachment,
'access_token' => $token,
'v' => self::API_VERSION
);
$v->msgsend("мои команды", $uid, $token, "photo-123_456");
<?php
for($i=0; $i<=10; $i++) {
echo "$i - " . f($i) . "\n";
}
function f($s) {
return crc32($s) & 0x7FFFFFFF;
}
/*
0 - 1960566561
1 - 64810935
2 - 450215437
3 - 1842515611
4 - 1941314360
5 - 78719918
6 - 498629140
7 - 1790921346
8 - 2046842643
9 - 218589061
10 - 559752673
*/
<tbody>
:<?php
foreach ($params['oldAttributes'] as $oldName => $oldValue) {
$newValue = $params['newAttributes'][$oldName];
printf( "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$oldName,
$oldValue,
$newValue === $oldValue ? '' : $newValue
);
}
?>
upload.wikimedia.org
$search = 'b';
$json = '{"1":{"name":"Browser"},"2":{"name":"Браузер"},"3":{"name":"Повар"},"4":{"name":"bонки"}}';
$data = json_decode($json);
$found = array();
foreach($data as $entry) {
$name = $entry->name;
if( false !== mb_stristr( $name, $search)) {
array_push( $found, $name);
}
}
print_r($found);
/* Array
(
[0] => Browser
[1] => bонки
) */
function cmp($a, $b) {
if ($a[2] == $b[2]) return 0;
return ($a[2] < $b[2]) ? -1 : 1;
}
);
usort($array, "cmp");
image.png|image.jpg|image.gif|audio.mp3
$first = [1,2,3,4,5,6,7,8,9,10];
$second = [ 10,9,8,7,6,5,4];
$unique = array_diff( $first, $second);
echo json_encode($unique); // [1,2,3]