Php String Loop Through Object Javascript Methods And Functions