newbie question why is '@' used ?
Moderator: General Moderators
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
I would like to add something here. @ has just saved my ass.
mb_strrpos should definately not trigger errors but alas is does and the best solution is @.
So there you have it.
This isn't true. There is no such thing as never in programming, I was being a cock. There is uncredibly rare, but not never. Anyway I experienced an incredibly rare occasion just now as this code snippet will demonstrate:I wrote:Never use @. Ever.
Code: Select all
$needle = 'something';
$haystack = ''; // nothing
strrpos($needle, $haystack);
mb_strrpos($needle, $haystack); // generates an E_WARNING telling you that your haystack is emptySo there you have it.