$myStrings = array();
$myStrings[] = 'string1';
$myStrings[] = 'string2';
...
foreach ($myStrings as $string)
{
// do stuff with your string here...
}
If you wanted to ensure uniqueness of strings in the array you could do a couple of things... first would be to simply use array_unique(). That, or you could create an associative array with the strings as keys as well as the values:
$myStrings = array();
$myStrings['string1'] = 'string1';
...
If you wanted to be object-oriented about this, you could do something like:
class StringStore
{
public static $strings = array();
// helper functions, etc. You could also make the above protected static and write public functions that add things to the array or whatever
}
Then, in your code you can do stuff like:
StringStore::$strings[] = 'string1';
...
And iterate the same way:
foreach (StringStore::$strings as $string)
{
// whatever
}
SplObjectStorage is for tracking unique instances of Objects, and outside of not working with strings, it's a bit overkill for what you're trying to accomplish (in my opinion).
Hope that helps!