PHP
php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
declare(strict_types=1);
class Chatbot
{
public $costumer;
public $likeThisArray = [];
function strSplitMe($findMichStart, $findMichEnde,$message) {
$strLen = strlen($message);
$posStart = strpos($message, $findMichStart);
$strposStart = strpos($message, $findMichStart) + strlen($findMichStart);
$strposEnde = strpos($message, $findMichEnde);
$nameLenght = $strposEnde - $strposStart;
$rest = substr($message, (($strLen - strlen($findMichStart) - $posStart) * (-1)), $nameLenght);
return $rest;
}
function getCustomer($message) {
if (substr( $message, 0, 3 ) === "I'm") {
$findMichStart = "I'm ";
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run