ruby on rails - How do I specify some parameter while keeping the parameters before it default in php

439

In functions such as the wordpress function wp_title. I have noticed they can have multiple parameters such as $sep, $display, $seplocation (using wp_title as a example).

I know with Ruby on Rails you can change any parameter such as $seplocation by using:seplocation => "left" or:seplocation => "right" while still keeping the other parameters as their defualt value. Therefore to bring me to my question: How do you make parameters such as $seplocation a specified parameter while keeping the others their default parameters?

Btw sorry if this is a duplicate, I did search to make sure it was not a duplicate however I am pressed for time and could not search as long as I would like.

Thanks for the help.

P.S. The ruby-on-rails tag was put in because I used ruby on rails as an example for my question.

664

Answer

Solution:

I don't know WordPress, but to pass arguments to a function and skip some, just passnull for the ones to skip:

$result = wp_title($sep, null, $seplocation);

People are also looking for solutions to the problem: PHP: prevent duplicated tags in Mysql

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.