Php String Loop Through Object Javascript Definition