S
S
Spark1082015-12-04 17:42:10
PHP
Spark108, 2015-12-04 17:42:10

How to replace the last character?

There is some string of numbers, I need to replace a certain number of the last characters in the string, how to do this?
ps: It is not known what the last characters will be.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2015-12-04
@spark108

$var = 'Hello world!';
$var = substr($var, 0, -6).'hell!';
//Hello hell!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question