ぱそきいろ @takacpu55 逃げ恥の一話見たけど、ガッキーの可愛さよりも納期直前の仕様変更により徹夜でプログラム組むSEの方が印象に残った 2016-10-23 11:05:58
ぱそきいろ @takacpu55 逃げ恥の一話見たけど、ガッキーの可愛さよりも納期直前の仕様変更により徹夜でプログラム組むSEの方が印象に残った 2016-10-23 11:05:58
今月頭頃にPHPの勉強を始めた時、編集者や知り合いと目標を目指して燃えていた。 しかしながら技術に詳しい人からの反応は常に「アレのどこがいいの?」というものばかりだった。 PHP、かつてパーソナルホームページの略であるとされ、その名前から元々シンプルかつカスタマイズが容易なWebサイトを作るために生まれてきたこの言語では、Webページにインタラクティブな要素を盛り込むことができる。 サイト上でPHPを用いることで、ページを静的なものから、投稿するとすぐにそれが反映されるBlogの様に動的なものにすることが出来る。 私がPHPに興味を持った最初の理由はこれだ。Blog構築で人気のプラットフォームであるWordPressは、Blogの見た目や機能をカスタマイズするためのテーマエンジンにPHPを用いているため、もしPHPを使えるのであれば、Blogのかなり細かいところまでいじることが出来る。 P
昔Qiitaで書いた内容なんですが、PHPのswitch文は悪名高い「==」演算子で比較を行います。 <?php switch (true) { case 0: echo '数字の0'; break; case '0': echo '文字列の0'; break; case '0.0': echo '文字列の0.0'; break; case true: echo '真偽値のtrue'; break; } このコードは「文字列の0.0」を出力します。大変分かりにくいですね。 この点はif ... elseif ...を使えば解決するんですが、switchで書きたくなるようなコードをelseifにするとおそらく読みにくくなるでしょう。 ではどうするか。 正解はオブジェクトのポリモーフィズム(多態性)機能を使うことです。 といっても、多態性で調べて出てくる記事とか書籍に関しては抽象的な説明が多い
PHPの==は両辺を適当に型キャストしてから比較するような演算子です。この型キャストの規則は難解すぎる上にドキュメントも不十分なため、PHPプログラマでも完璧に理解している人はほとんど居ないくらいの印象です。バグの原因になりかねないため、なるべく==を使わないようにしているPHPプログラマも多いはずです。 ところで、この==演算子の挙動がPHP 5.4.4から変更されていることはあまり知られていません。本稿ではこの内容を紹介します。 Bug #54547 の騒動 まずはこの仕様変更の経緯を紹介します。 2年ほど昔、Hacker Newsで2^63付近の整数に対応する文字列をPHPで比較したときの挙動がおかしいというスレッドが盛り上がったことがありました。具体的には、PHPでは「'9223372036854775807' == '9223372036854775808'」がtrueになるとい
PHPの関数やコード例の動作確認をどのように行っていますか? 最も基本的な方法は変数や関数の戻り値を逐次、echoで出力する方法でしょう。 しかしこの方法では何度もコード編集と実行を繰り返す必要があり非効率です。デバッガやIDEの使用も解決策の1つですが、大げさすぎたりパフォーマンスの問題がある時もあります。 一方でRubyの世界を見てみるとirbやpryを使ってコンソール上でリアルタイムにコードを試す姿が一般的です。 今回はPHPで対話的なデバッグやコード実行を行えるPshSHを紹介します。 PsySH 従来の手法 php -a PHPには標準で対話シェルモードがPHP5.1以降から搭載されています。 しかしこの機能を利用するには--with-readline付きでPHPがコンパイルされている必要があります。 readlineが利用できない場合はインタラクティブシェルの変わりにインタラク
株式会社アクトキャットのCEOのブログです。Web系スタートアップ・ベンチャー企業に興味がある人や就活生に役立ちそうな事を自由に考えて投稿しています。 Rubyist is better than PHPer、ルビー使いがペチパーより優れている理由を3つ上げます。PHPおよびPHPerはコードを書くのが嫌いPHPerは実はHTMLに毛が生えた程度しか使えない人が多いPHPは低級プログラマと過去の負債に引きずられるRubyとだけ比較してますが、Pythonと比較しても、Node.jsと比較しても別に良いでしょう。結果は一緒です。さぁPHPを投げ捨てよう!PHPおよびPHPerはコードを書くのが嫌いこの根拠は、PHPがほかの言語に比べてPaaSで動きにくい、というのを根拠にしています。PaaSで動くためには、少なくても下記の条件を満たしている必要があります。DB Schemeをコードで管理して
オープンソースのWeb開発向けスクリプト言語「PHP」の文法を一から学ぶための入門連載「Web業界で働くためのPHP入門」。前回の「初心者がPHPプログラミングを始めるための基礎知識とXAMPPのインストール」では、PHPの概要や特徴を紹介し、環境構築や「Hello World!」までの手順などを解説しました。 今回からは環境がセットアップできている前提で進めますので、まだの方は前回を参照して準備をしておきましょう。 PHPタグでPHPのコードを埋め込む PHPでは、テキストファイルにコードを書けば、それをそのまま実行できます。このような言語は、他にPythonやRuby、Perl、JavaScriptなどがあります。ただ、PHPの場合はテキストファイルに一定の形式で書くことが必要です。 それは、コードは「<?php」と「?>」というPHPタグの間に書かなくてはならない、ということです。例
たにぐちまことさんの よくわかるPHPの教科書がこのたび改版されて、よくわかるPHPの教科書 【PHP5.5対応版】として出版されました。旧版はmysql関数を使ってSQL呼び出ししていましたが、mysql関数がPHP5.5にて非推奨となったための緊急対処的な内容となっているようです。つまり、従来mysql関数を呼び出していた箇所をmysqliの呼び出しに変更したというのが、主な変更点のようで、これ以外はあまり変更点は見あたりません。 既に、Amazonでは、熱烈な読者の方からの詳細のレビューが届いています。 神本御降臨! 言わずと知れたPHPプログラミング書籍のロングセラー。 2010年9月に発売された前作の改訂版。 PHPのバージョンも最新の5.5に対応、内容は前作と殆ど同じ。 少し前に前作を購入した方も本書を購入した方がいいでしょう。 【中略】 それにしても、帯の「3万人に読まれた定
昨日エントリ( http://uzulla.hateblo.jp/entry/2014/03/08/050621 )を書いたKodingですが、詳しくは昨日のエントリを見ていただくとして、今度発売される「Webアプリエンジニア養成読本」をKodingで勉強するにはどうすればよいか書いてみます。 Webアプリエンジニア養成読本[しくみ、開発、環境構築・運用…全体像を最新知識で最初から! ] (Software Design plus) 作者:和田 裕介,石田 絢一 (uzulla),すがわら まさのり,斎藤 祐一郎技術評論社Amazon 結果として、Kodingをつかえば、ChromeやFirefoxがPCにはいっていれば、PCに何もインストールすることなくブラウザ一つで学習ができました。 このエントリに記載されていること ・Kodingのアカウント取得 ・画面の簡単な説明 ・PHPをちょっ
自分の担当したWebアプリケーションを引き継ぐ際に、予備知識として説明したことのまとめ 注意事項 もともと明確に定義されていない概念や、簡単に説明するため正確さを犠牲にした部分が多い 間違っていることを前提に、疑いながら読むのがベター アプリケーションの層構造 アプリケーションを構成するオブジェクトには非常の多くの種類がある アプリケーションの(より良い)構成をオブジェクト単位で考えるのは難しいので、もっと粒度の大きい単位で考えたい アプリケーションをいくつかの層(オブジェクトの所属するグループ)に分割し、層単位でアプリケーションの構成を考える View層(ビュー層) レスポンスをクライアントにとって都合のいい形(i.e. 画面)に変換する層 View層のオブジェクトは Controller層のオブジェクトから利用される DomainModel層のオブジェクトを利用して、ユーザーに表示した
仕事としてコードを書くようになって3週間が経ったので ここらで所感をまとめてみたいと思う。 ベンチャーと大手企業の違いみたいなことを書いてもいいんだけど、 正直今のところ「あまり変わらない」印象。 それもそのはず、現職もエンプラ向けの仕事。 SIと仕事のやり方はかなり似ている。 ので、純粋にプログラマとして思ったことを。 スパゲッティコードとの出会い この3週間で触ったのはウチの会社で改修・保守をやっているシステムの バッチや管理画面の細かい修正など。 コードは全てPHPだった。 この辺は一番経験のある言語だったので助かった・・・と思った。 が、意気揚々とソースを見て愕然とした。 処理ベタ書きのずらずら続く手続き型の処理は序の口。 関数を定義する代わりにベタ書きスクリプトを外出しにしてrequire 意味不明な変数名 同じ処理をしているはずなのに名前だけ違う関数達 無計画なテーブル定義 業
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く