Jonnie Grieve Digital Media: Website Blog.

Archived Posts: September 2016 – Jonnie Grieve Digital Media posts.

A bit of fun with modifying arrays.

When you want to modify a simple array, you generally want to add values to it or remove items.  There are 4 common methods in the PHP arsenal that will do this.

There’s

  • push()
  • pop()
  • shift()
  • unshift();

Now these are 4 easy methods to write, but when you have a learning disability like I do the struggle to remember what each of them does is eternal. I know that I either want to add something to an array or remove it.  Does push do that? Or pop? Pop sounds like something that would separate or remove one thing from another right?

Good hunch!  But which end?  According to the documentation the value at the end of a given array will be removed.

So the array should now return

$sport = (‘Hockey’,’Cricket’);

And the array now has only 2 elements and array_pop is the method that removes a value or values from the end of an array.

So how then do you remove an element from the beginning of an array?

which would return…

So for removing elements from an array, pop() deals with the end of an array but shift removes them from the beginning.

which will return

For this we have the methods for push and shift. These methods will add one or more elements to a given array.

returns

In conclusion the methods can be summarised below.

array_unshift()  Removes an element from the beginning of an array
array_shift()  Adds an element from the end of an array
 array_pop()  Removes an element from the end of an array.
 array_push()  Adds an element to the beginning of an array.

Be wary of phishing scams

Good Morning everyone. As you know the internet is awash with scams with people trying to grab your money dishonestly with differing levels of credibility. Some emails are poorly crafted but some use persuasive and business like language to attempt to fool you out of your money.

Every so often I get one requesting me to register a domain for one of my clients. Ones that say things on the lines of “this is a courtesy email not a demand for payment.”. That’s nice isn’t it?

“As a courtesy to domain name holders, we are sending you this notification for your business Domain name search engine registration.This letter is to inform you that it’s time to send in your registration and save.Failure to complete your Domain name search engine registration by the expiration date may result in cancellation of this offer making it difficult for your customers to locate you on the web.”

Quite compelling, isn’t it? Almost enough for me as a web designer to look into this further and find out if there’s anything in it; find out how I can sort this out and if necessary, send payment. Then I look at the prices quoted. $75 (around £50 or so) to “keep registration” for a year. Alarm bells are ringing with me and I trust they are with you as well. It should never cost you that much to register a domain (which should already have been sorted with a Web host company) with a web domain registrar.It is of course another scam and I won’t be pursuing that particular matter any further. Any correspondence I need to take action on, my web host company can inform me.

You don’t need to pay a huge fee to get your website listed on a search engine. Getting a top ranking on search engines and maintaining it is another matter but assuming you continue to use white label SEO techniques your actual listing shouldn’t ever be in danger.I urge anyone who happens to come by such emails to inform their web designer or web host before you lose any money you don’t need to 🙂

 Here’s a link from another company letting you know what to look out for.  http://easykey.uk/phishing-emails-and-scams/scam-domain-registration-renewal-notice