Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
function getComment($senderComment, $recComment)
{
$comment = [];
if (!empty($senderComment)) {
$comment[] = $senderComment;
}
if (!empty($recComment)) {
$comment[] = $recComment;
}
if (empty($comment)) {
return null;
}
$fullComment = implode('. ', $comment);
var_dump($fullComment);
$comment = mb_substr($fullComment, 0, 255);
var_dump($comment);
return $comment;
}
$senderComment = '156016, Кос тромская обл., г. Кострома, мкр-н Давыдовский-3, д.32, пом. 1, ком. 112\156016, Кос тромская обл., г. Кострома, мкр-н Давыдовский-3, д.32, пом. 1, ком. 112';
$recComment = '+79009111011 Коротков Денис';
$a = getComment($senderComment, $recComment);