Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Markus77's avatar

PHP Convert string to array

Hello

How to convert string to ascii Byte Array??

I want to integrate propay payment gateway to my code to create merchant account and its not working.

0 likes
1 reply
tisuchi's avatar
tisuchi
Best Answer
Level 70

@markus77

In PHP, strings are already byte arrays. So to put together the auth header for ProPay, see the following example:

$certStr = 'MyCertStr';
$termId = 'MyTermId';

$base64 = base64_encode($certStr.':'.$termId);
$authorization = 'Basic '.$base64;

//Output: "Basic TXlDZXJ0U3RyOk15VGVybUlk"

1 like

Please or to participate in this conversation.