0

i want to replace a string with database function if it exists. i am using str_replace in following way but it doesn't work for me, this is returning $numOne as it was. i am beginner in php so help me

function stringreplace($multiple,$numOne){
$multiple=Multiply;
$numOne=a_b_cMultiply;
str_replace($multiple,"abcdfgh('','')::numeric",$numOne);
return $numOne;
}
Danish Bhatti
  • 41
  • 1
  • 3
  • 13

1 Answers1

2

Your code is not correct as you are not storing the result anywhere and also you are returning $numOne which contains the old value . Use this code:

function stringreplace($multiple,$numOne){
$multiple='Multiply';
 $numOne='a_b_cMultiply';
 $num_one = str_replace($multiple,"abcdfgh('','')::numeric",$numOne);
return $num_one;
}
Rahul
  • 2,374
  • 2
  • 9
  • 17