A
A
Anton2018-04-24 13:33:33
PHP
Anton, 2018-04-24 13:33:33

How to convert text in php?

$A = $value;
echo $A;  //покажет Alfa Romeo

You need to echo the converted text so that it looks like this (lowercase characters and underscore if more than one word):
echo $A; //покажет alfa_romeo, но не Alfa Romeo

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kornilov, 2018-04-24
@KorniloFF

<?
function f($str)
{
  return strtolower(str_replace(' ', '_', $str));
}
echo f('Alfa Romeo');
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question