2021年2月7日星期日

how can i replace every single character with a "?" mark in a string with php

so for example i gave this string

sbbibs    

with php i would like to change it to

  ??????    

my query currently is this, i cant continute yet cus the ? marks

  namespace modules\xenforums\sql;    trait create_row {            function create_row($types, $table, $column, $param, $conn) {                    $param = "'" . implode ( "', '", $param ) . "'";            $placeholders = str_split($types);            $a = str_replace(); // this is where i want to make every type to ?            // posible value of $type, sssissb                    $query = "INSERT INTO {$table} ({$column}) VALUES ({$placeholders})";            var_dump($a);                }        }    

how could i do so?

im doing this because i made a php mysqli query builder and now i'm trying to replace the data types with ? to get the amount of given parameter

iv tried using str_replaces but that only does 1 specific

i also had the idea of doing str_replace for every char, but that's too tedious

iv also thought about just doing it for the current data types, but for other data base systems thats not all the same

https://stackoverflow.com/questions/66094547/how-can-i-replace-every-single-character-with-a-mark-in-a-string-with-php February 08, 2021 at 08:30AM

没有评论:

发表评论