Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Get string length
<?php mb_strlen(string $string, ?string $encoding = null): int
<?php             'httpMethod' => 'POST',

            'headers' => [

                'Content-Type' => 'application/json',

                'Content-Length' => mb_strlen(json_encode('Hello world!')),

            ],

            'body' => json_encode('Hello world!'),

        ];
<?php             'httpMethod' => 'POST',

            'body' => 'foo=bar&bim=baz',

            'headers' => [

                'Content-Length' => mb_strlen('foo=bar&bim=baz'),

            ],

        ];

        $this->assertGlobalVariables($event, [
<?php             'headers' => [


                'content-type' => 'application/json',

                'content-length' => mb_strlen('{}'),

            ],

            'body' => '{}',

        ];
<?php             'httpMethod' => 'POST',

            'headers' => [

                'Content-Type' => 'multipart/form-data; boundary=testBoundary',

                'Content-Length' => mb_strlen($body),

            ],

            'body' => $body,

        ];
<?php             'httpMethod' => 'POST',

            'headers' => [

                'Content-Type' => 'multipart/form-data; boundary=testBoundary',

                'Content-Length' => mb_strlen($body),

            ],

            'body' => $body,

        ];
<?php             'httpMethod' => 'POST',

            'headers' => [

                'Content-Type' => 'multipart/form-data; boundary=testBoundary',

                'Content-Length' => mb_strlen($body),

            ],

            'body' => $body,

        ];
<?php             'isBase64Encoded' => true,

            'headers' => [

                'Content-Type' => 'application/x-www-form-urlencoded',

                'Content-Length' => mb_strlen('foo=bar'),

            ],

            'body' => base64_encode('foo=bar'),

        ];