Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

removed spacel caracter using php

<?php
$strTemplate = "My name is :name, not :name2.";
$strParams = [
    ':name' => 'Dave',
    'Dave' => ':name2 or :password',
    ':name2' => 'Steve',
    ':pass' => '7hf2348', ];
echo "
" . strtr($strTemplate, $strParams) . "
";
echo "
" . str_replace(array_keys($strParams), array_values($strParams), $strTemplate) . "
";


?>
  Output:

My name is Dave, not Steve.
My name is Steve or 7hf2348word, not Steve or 7hf2348word2.
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #removed #spacel #caracter #php
ADD COMMENT
Topic
Name
4+1 =