Thanks to the comments (@AbraCadaver), Complex (curly) syntax is the way to go for invalid variables or property names:
$insertArray[0]->{"First.Name"} = $firstname;
More Related Contents:
- How can I access an array/object?
- instantiate a class from a variable in PHP?
- Accessing a class constant using a simple variable which contains the name of the constant
- Initializing PHP class property declarations with simple expressions yields syntax error
- PHP Accessing Parent Class Variable
- Accessing Class Properties with Spaces
- PHP check whether property exists in object or class
- Workaround for basic syntax not being parsed
- Constant expression contains invalid operations [duplicate]
- implicit class variable declaration in php?
- Public static variable value
- How do I pass JavaScript variables to PHP?
- PHP – concatenate or directly insert variables in string
- Are PHP Variables passed by value or by reference?
- php – insert a variable in an echo string
- PHP Multiple Checkbox Array
- What is ::class in PHP?
- Best way to test for a variable’s existence in PHP; isset() is clearly broken
- Use a variable to define a PHP function
- How can I access a deep object property named as a variable (dot notation) in php?
- PHP DateTime() class, change first day of the week to Monday
- Why PHP variables start with a $ sign symbol?
- Can I use string concatenation to define a class CONST in PHP?
- Determining what classes are defined in a PHP class file
- Undefined variable problem with PHP function
- How do you pass objects by reference in PHP 5?
- Calling a function within a Class method?
- Laravel / Intervention Image Class – class not found
- Which is faster? Constants, Variables or Variable Arrays
- Access object property with disallowed character in property name