How to remember PHP's parameter order? - php

This will be quite a short question as there is little to no explanation required.
Sometimes I'm having a hard time remembering in what order parameters are supposed to be used in PHP functions. What I mean by this is that I sometimes just do not know if I should use needle, haystack or haystack, needle.

Use an IDE like PDT for Eclipse https://eclipse.org/pdt/
It will show you the parameter order automatically when typing.
PHP unfortunately is quite inconsistent in this regard and remembering all of them in your head might be a taks of a life time.

Ill keep the answer as short as the question: RTM
For example
http://www.php.net/stristr
http://www.php.net/substr
That will tell you the order for every function like that and alot more about it. Change the function name, see the order.
Whenever in doubt, Type php.net/[function_name] and you dont have to remember everything about the function.

If use Firefox as web browser, go to the PHP Manual page, write something (the name of the function, maybe) in the Search box of your browser.
Open the list of search providers (using the Down arrow if it does not open automatically). At the end of the list you'll find Add "PHP.net search".
After you add PHP.net as a search provider, searching for help directly from your browser becomes an easy job.
How to install the PHP.net search provider in Chrome:
As for Firefox, go to the PHP.net website then open Chrome Settings (you'll find it on the menu) and press the "Manage search engines..." button. A new window titled "Search engines" appears an the bottom list contains the search engines provided by the pages that are open now in various tabs and are not already installed.

Related

How to find all files with a function in phpstorm?

How I can find and show all files in Phpstorm where this method
$this->other_model->any_method()
is called?
cmd+shift+f for Mac and ctrl+shift+f for Windows will find any piece of text throughout the project or directory. Or you could use alt+f7 to find usages.
PHPStorm Keyboard Mapping.
Viewing Structure of a Source File.
You can search for symbol with combination Ctrl+Shift+Alt+N. This combination allows you to search not only PHP classes/methods but also PHP variables, CSS classes etc.
If you want to find method usages in files:
click on your method and press Alt+F7
If you want to search any composition of your desire search, you can use from searching everywhere. I prefer to use this because PhpStorm makes it possible to look for any item of the source code, databases, actions, elements of the user interface, etc. in a single action.
to use that, only press search button in the right upper corner of phpStorm or 2 times press shift key on your keyboard. Now you can find your search everywhere. This is great functionality of phpStorm.
To read more information about using this search method, go to the following link:
Searching Everywhere
To See all the methods for search in phpStorm, Go to the following link:Searching Through the Source Code

Eclipse content assist behavior. Can it be more like Apatana or phpEdit

I am trying to make the switch to eclipse and for the most part I am happy, however this is one behavior that is quite bothersome to me. Let's say I am calling function
foo (arg1, arg2, arg3, arg4)
when I type foo( - the function insight pops up and shows me the parameter list.
As soon as I start typing the value of the first parameter it goes away. Now I have to use my mouse to hover over the function name to see the next argument.
I am coming from PHPEdit and in that system it would highlight each parameter as I typed and did not require me to break away from the keyboard to use the mouse, which is quite annoying.
Is there any setting that can be tweaked or am I stuck with this? I noticed that apatana studio works the way I want it to. Maybe a plugin of some sort?
I want to love eclipse, but this is a deal breaker (having to use the mouse). I'm sure it's just because I don't understand it. I tried hitting ctrl+space and that did not show me the parameter list.
Another issue I have is the function insight seems to be picky as to when it even decides to show up. I'll type $string = str_replace and it will not show up. I'll simply delete str_replace and start typing again and it may or may not show up the second time (It does not show up about 40% of the time)
Ok thanks. Hopefully we can work it out, because I do enjoy some of the features of this platform.
--EDIT-- version is 4.2.0
I just tried this with the Eclipse 4.2 Java editor.
If you hit the Enter key after you type a parameter, it shows the next parameter in a tool tip.
Let me know if it works the same way for PHP.

Can Dreamweaver show a list of variables, functions, class?

Is there a window in Dreamweaver that shows all variables and functions defined in the current document?
When you right click on the current document, you will see Functions context menu which contains the methods used.
Another trick is to edit the toolbars xml file and uncomment the code nav button.
This gives you a toolbar button you can click to list the methods, rather than right clicking and selecting functions from the context menu.
Still not as good as a permanently visible pane, but one less click than the right click > functions context menu.
Open this file:
C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS5\configuration\Toolbars\toolbars.xml
Uncomment this block:
<menubutton id="DW_CodeNav"
image="Toolbars/images/MM/codenav.png"
MMString:tooltip="DW_CodeNav/menubutton/tooltip"
enabled="dw.getFocus() == 'textView' || dw.getFocus() == 'html'"
menuID="DWCodeNavPopup"
update="onViewChange"/>
Restart Dreamweaver for the changes to be applied.
Code Nav icon "{}" appears at the end of the Document toolbar. The toolbar with (code|split|design).
No, Dreamweaver, at least through CS5, does not have a window that lists variables and functions in the document. The CS5 code hinting engine is pretty good, so it should at least allow you to quickly type your code, but if you need a list outside of the document itself, there is no such thing.
There used to be an extension that would list functions defined in the page in a floating panel, Interakt's MX Code Pack, but it is no longer available as Interakt was acquired by Adobe, and their products subsequently "retired":
MX Coder Pack
This is an old topic but I thought I would update it since I submitted a feature request to Adobe to implement an "outline view" which would address OP's original question. The feature would list functions inside of a page similar to how other IDE tools like Eclipse do it. Dreamweaver currently does this for JavaScript functions only but this feature request would enable it for other types of pages as well (cfml, php, asp) and also let you see the DOM outline for any page.
Feel free to submit your request to Adobe here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform&loc=en
Be sure to reference enhancement request #3812052. If enough people ask for this feature, perhaps Adobe will listen.
I have no sulution for the variables, but for functions I use a little trick:
I do a search (ctrl+f) for the string "function " and the press "find all" this'll show the result window with all lines with "function "in it. Double clicking a line in the result window will take your to the appropriate function.
You can make something with regular expression where you search for function ({some chars}){ to be absolutely certain to only get function declarations.
You can then save this query and load it as needed.
Indeed code hinting is the only way I've been able to view a functions list in CS5. The HOTKEY for code hinting is ctrl+spacebar.

Is there any way to see the functions that are executed after pushing a link or a button in a web page done with PHP?

is there any way to see the functions that are called after pushing a link or a button in a web page done with PHP?
I user Firefox.
Regards
Javi
Not exactly sure what you're trying to achieve but you could install/configure a debugger module like xdebug.
Then you can either step through the code or use the profiler to see which functions have been hit (and how long they took).
It it's your own code, open it in the editor.
If it's someone's else code, there is no way.

how do you take a snapshot of your current browser window using php

I've tried searching everywhere but there's seems to be no implementation available other than having the client use a file (batch/exe of some sort).
You just can't do it. PHP is server side scripting language, maybe you can do that using JavaScript, but I'm not even sure about that.
I know someone implemented such service, but actually he had to use Mozilla browser, which opened, a script (I think it was not JS, maybe perl, c/c++) made a screenshot and uploaded it.
I'm assuming you mean "your" in the general sense. If you mean "how does one take a screenshot...", you generally hit the print screen key. If you're trying to capture your users' browser output, I'd say that it's probably not possible. If it were, the best you could get is the output of what you wrote yourself.
Google Gears might be hackable to do something close, if you can simulate the print screen key press with JS and get the file to save somewhere gears can access.
You can't do that in PHP, as PHP is running on the server, and not the client.
To get screenshots of the browser, you can take a look at, for instance, this list.
If you are look for an automated solution to take screenshot of web pages opened in a browser window, you could also look at this question : How to capture x screen using PHP, shell_exe and scrot and it's answers.
And, finally, and without selecting any particular post, you can try a search on SO ; something like screenshot browser, sorted by relevance, seems to get some interesting posts :-)
Good luck !

Categories