My code is a simple code but i not seing what the problem might be.
I'm doing a "for" to get a number from 1 to 2000, then replacing the number into text, example '1px','2px',...
Then i set this "'1px','2px',..." in a array. For that reason i could verify where in the text has "px" , then i could repalce it with "%". PS: "%" is also an array.
To replace the text, i use str_replace, and it funcional, but not when i use it with my code.
$search = array('150px','151px','152px','153px','154px',...);
$replace = array('100%');
$testes = str_replace($search, $replace, $GetText)
Example of $GetText - <p><img src="data:image/png;base64,iVBOC" data-filename="andy-brown_4.png" style="width: 150px;"><br></p>
this codes work
Now the code that im trying,
for($i = 1; $i<=2000; $i++) {
echo "'". $i . 'px' . "'," ;
$test = "'". $i . 'px' . "'," ;
}
Show all the number from 1 until 2000 with text, example: '274px',
$search = array($test);
$replace = array('100%');
$testes = str_replace($search, $replace, $GetText)
With this process, it doesnt replace the "px" with "%"