Skip to content

Tag: str-replace

STR_REPLACE to add prefix to mysql query in php

This is my query This is the function to add prefix to tables (This function is taken from MySqliDB class) When I echo rawAddPrefix($q,”demo_”) I get only prefix added to tbl_accounts table only. I need to add prefix to all tables. What’s wrong here ? Answer That function above does only poi…

Replace multiple dashes with one dash

I have a string which looks like this: I want to replace the multiple dashes with a single one. So the expected output would be: I tried to use str_replace(), but I have to write the code again for every possible amount of dashes. So how can I replace any amount of dashes with a single one? For Rizier: Tried: