As I review how to programmatically create content, mostly using Drupal 7 resources, I'm seeing both of these options and have a situation where one is working for some things and the other for others things. But, I don't understand the difference. 

$node->save();

node_save($node);

Accepted answer

Yep, node_save() is just a wrapper for $node->save(). This is because the latter is Object-Oriented Programming (OOP), and a lot of people aren't as familiar with that. So the former can be used instead for those who are more familiar with procedural programming.

And yes, if you're having issues then it's likely affected by other factors since both of these functions should be otherwise exactly the same.

Comments

BWPanda's picture

Yep, node_save() is just a wrapper for $node->save(). This is because the latter is Object-Oriented Programming (OOP), and a lot of people aren't as familiar with that. So the former can be used instead for those who are more familiar with procedural programming.

And yes, if you're having issues then it's likely affected by other factors since both of these functions should be otherwise exactly the same.