How To Check If Array Element Exists In Another Array In PHP

This is the best 1 liner answer I found in the Internet to check if an array’s item or value or however you may call it exists in another array.

Using the function array_intersect(), you can achieve this. User lorenzo-s from Stack Overflow gave this 1 liner code that did the trick.

Do note that array_intersect() is case sensitive.

Donations appreciated. Every little $ helps. Or click Google +1.

How To Fix Deprecated: Function eregi_replace() is deprecated In PHP

Well, if it says it is deprecated it does not work that it does not work anymore. Just that PHP advises developers to steer away from deprecated code and/or functions and use the new ones.

However, if you are still motivated to use the eregi_replace() function even though it is deprectead, just add @ to it so that the warning message for this will not appear.

Remember, just add @. So it will be @eregi_replace().

Donations appreciated. Every little $ helps. Or click Google +1.

Access denied for user ‘root’@'localhost’ (using password: YES) In WAMP

This is a problem that hounds PHP developers quite often. Even using WAMP it still gives this error which confused me because I did not encounter any problems when I added a new user account in MAMP.

I did exactly the same steps when adding a new database user account in WAMP and it always gives the Access denied for user ‘root’@'localhost’ (using password: YES).

To get around this problem, it is always best to use a different user account other than root. To add a new user account with the same privileges are a root user account, do the following steps:

- click the database and go to PRIVILEGES tab
- click EDIT PRIVILEGES on the entry named user:root and host:localhost
- scroll down. there should be a login information section. in the user name field, type a new username
- set a password
- then click the GO button below it. it should create the new user account with the same privileges as the root user account.

A note to consider: Make sure you change the password of the root user account because by default the password is blank.

Donations appreciated. Every little $ helps. Or click Google +1.

Related Posts Plugin for WordPress, Blogger...