0

I have a string like this.

$function = "
array_splice($arr . $arrayimploded, end($index), 1, $data);
";

$arr is an array

$arr = array(0 => array(0 => "s",
1 => "es"),

1 => array(0 => "ing"),

2 => array(0 => "d",
1 => "ed")
);

The $arrayimploded is "[0]"

The end($index) is "1"
The $data is "bob"

So I'm trying to get php to do interpret that message as

array_splice($arr[0], 1, 1, 'bob');

I don't know how to use eval() and nothing on google seems to tell me how to use it.

Thanks in advance.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by CMCDragonkai
0

What makes you have $arrayimploded as "[0]"? Why not just 0 and use the function properly:

array_splice($arr[$arrayimploded], end($index), 1, $data);

If you can avoid eval(), avoid it.

0

Cause the amount of the [] things keys are unknown and I had to implode the number before hand. Anyhow Someone already beat you to it and sorted it out. Thanks anyway.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.