This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function decodes GCLID (Google Click ID) and extract timestamp from it. | |
* | |
* @param string $gclid | |
* | |
* @return int|null | |
*/ | |
function getTimestampFromGclid(string $gclid): ?int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"github.com/tarm/serial" | |
"bufio" | |
"fmt" | |
) | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$result = []; // пустой массив | |
echo json_encode($result, JSON_FORCE_OBJECT); | |
// {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$result = []; // пустой массив | |
echo json_encode($result); | |
// [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$result = ["key1" => "value1", "key2" => "value2"]; | |
echo json_encode($result); | |
// {"key1":"value1","key2":"value2"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = [ | |
"0000021", // нули слева | |
6.12345678910111213, // много знаков после точки (будет округленно) | |
"+81011321515", // телефон | |
"21E021", // экспоненциальная запись | |
]; | |
echo json_encode($data, JSON_NUMERIC_CHECK); | |
//[ | |
// 21, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo json_encode(["string_float" => "3.0"], JSON_NUMERIC_CHECK | JSON_PRESERVE_ZERO_FRACTION); | |
// {"string_float":3.0} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo json_encode(["string_float" => "3.0"], JSON_NUMERIC_CHECK); | |
// {"string_float":3} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo json_encode(["string_float" => "3.0"]); | |
// {"string_float":"3.0"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$decoded = urldecode("%EF%F2%E8%F6%E0"); | |
$utf8 = utf8_encode($decoded); | |
echo json_encode($utf8); | |
// "ïòèöà" |
NewerOlder