09 October 2009

Inconsistent PHP - I'm sick of it

PHP is inconsistent, sick of it. $needle or $haystack? Which one first? List of php function that inconsistent needle/haystack

helmi@gandalf:/usr/share/doc/php-doc/html> grep -l needle *| grep ^function | sed 's/^function.//'| sed 's/.html$//'| sed 's/-/_/'
array_search
grapheme_stripos
grapheme_stristr
grapheme_strpos
grapheme_strripos
grapheme_strrpos
grapheme_strstr
iconv_strpos
iconv_strrpos
in_array
mb_stripos
mb_stristr
mb_strpos
mb_strrchr
mb_strrichr
mb_strripos
mb_strrpos
mb_strstr
mb_substr-count
stripos
str_ireplace
stristr
strpos
strrchr
str_replace
strripos
strrpos
strstr
substr_count


So I refer to php manual everytime use these functions, grrr. For vim, i override key binding for 'K' (:help K) - "Run a program to lookup the keyword under the cursor". In .vimrc
autocmd FileType php set keywordprg=~/bin/php_doc

and my ~/bin/php_doc

#!/bin/sh
FN=`echo $1 | sed 's/_/-/g'`
echo ********************** $FN **********************

echo $FN
w3m file:///usr/share/doc/php-doc/html/function.$FN.html

No comments: