/    Sign up×
Community /Pin to ProfileBookmark

spl_autoload

just wondering what the difference is between spl_autoload and spl_autoload_register. cant find anything i can understand through google.

thanks in advance

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@coleioauthorJun 30.2019 — bump bump bump bump it up
Copy linkTweet thisAlerts:
@ginerjmJun 30.2019 — And you didn't like what the official php manual said either?
Copy linkTweet thisAlerts:
@coleioauthorJul 01.2019 — i understand what your trying to say, it does look like im not even trying but i checked the php manual and it doesnt give a clear exapmle that i can follow. any help is greatly appreciated
Copy linkTweet thisAlerts:
@ginerjmJul 01.2019 — You're correct - it really doesn't make sense to me. But OTOH - why do you/I care even? What is the purpose of either one of these functions? From some other reading it appears that the only need for either of these is if you are using a whole bunch of classes that may or may not be inter-related and you have many scripts that require them all to be loaded and you don't want to have to add them manually (or not). I dunno.

But since I DON'T WRITE that many classes, I don't think I'll ever need be concerned. Are you into writing that many classes already in your development?
Copy linkTweet thisAlerts:
@coleioauthorJul 01.2019 — the __autoload function is used to load several files in a specified folder to save having several includes but that was deprecated and replaced by spl_autoload and the PHP manual isn't very noob friendly so I can't figure out how to use it correctly. Any resource I have found so far refers to spl_autoload_register and I haven't the foggiest on that.

However I may have found a helpful article regarding these functions so I will post it here once I've read it
Copy linkTweet thisAlerts:
@NogDogJul 01.2019 — This appears to be a fairly succinct article that might help: https://resoundingechoes.net/development/autoloading-classes-php/
Copy linkTweet thisAlerts:
@coleioauthorJul 01.2019 — that has cleared up alot of my confusion thanks again Nogdog

×

Success!

Help @coleio spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...