rgb192
asked on
strreplace
Array ( [my_textarea] => HELLO )
str replace
only want 'HELLO'
str replace
only want 'HELLO'
ASKER
that is not working
is there a way to do it with a str_replace
is there a way to do it with a str_replace
What you have there is not a string, but the result of print_r I am guessing?
If that is the case, you cannot simply use str_replace because it is not a string.
Please post your code and I will assist further
If that is the case, you cannot simply use str_replace because it is not a string.
Please post your code and I will assist further
ASKER
it is not the result of print_r
$variable='Array ( [my_textarea] => HELLO )';
echo $varible
$variable='Array ( [my_textarea] => HELLO )';
echo $varible
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try to use eval() method:
$data = 'Array ( my_textarea => HELLO )';
eval("\$arr = $data;"); // remember to use ";" at the end (after $data)
And from now in variable $arr you've got your array. If want your "HELLO" use:
echo $arr['my_textarea'];
Greetings!
$data = 'Array ( my_textarea => HELLO )';
eval("\$arr = $data;"); // remember to use ";" at the end (after $data)
And from now in variable $arr you've got your array. If want your "HELLO" use:
echo $arr['my_textarea'];
Greetings!
Yes, along with a bunch of errors.
Only twice Noticy ;)
but when you add:
$data = 'Array ( [my_textarea] => HELLO )';
$data = strreplace(array('[', ']'), array("['", "']"), $data);
it be nicer, a little ;)
but when you add:
$data = 'Array ( [my_textarea] => HELLO )';
$data = strreplace(array('[', ']'), array("['", "']"), $data);
it be nicer, a little ;)
ASKER
thanks
If so, just echo like this:
<?php
$myarray = Array(my_textarea => 'HELLO');
echo $myarray['my_textarea'];
?>
Hope this helps,
John