Skip to Content
初めてのPHP
book

初めてのPHP

by David Sklar, 桑村 潤, 廣川 類, 木下 哲也
March 2017
Intermediate to advanced
364 pages
9h 45m
Japanese
O'Reilly Japan, Inc.
Content preview from 初めてのPHP
97
6
データとロジックの結合:
オブジェクトの操作
これまでに説明したデータとロジックの基本がわかれば、十分に PHP で多くのことを実行でき
ます。さらに高度な概念(オブジェクト指向プログラミング:データとデータを操作するロジック
の結合)を理解すると、コードを構造化するのに役立ちます。特に、オブジェクトは再利用可能な
コードを作成するのに適しているので、オブジェクトに精通すると既存の多くの PHP アドオンや
ライブラリを利用しやすくなります。
プログラミングの世界では、オブジェクトは対象(前菜の材料など)に関するデータとその対象
に対する動作(前菜にある材料が入っているかどうかの判断など)を結合する構造です。プログラ
ムでオブジェクトを使うと、関連する変数と関数を 1 つにまとめるための構造を提供します。
オブジェクトを扱う際に知っておきたい基本用語を以下に示します。
クラス
ある種のオブジェクトの変数と関数を表す
テンプレートまたはレシピ。例えば、
Entree
クラスには名前と材料を保持する変数が含まれる。
Entree
クラスの関数は、前菜の調理、
提供、特定の材料が含まれているかどうかの判断などになる。
メソッド
クラスで定義されている関数。
プロパティ
クラスで定義されている変数。
インスタンス
クラスを利用した個々の実体。プログラムで夕食に 3 つの前菜を提供している場合、
Entree
クラスの 3 つのインスタンスを作成する。それぞれのインスタンスは同じクラス
をベースにしているが、内部では異なるプ
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

アイソモーフィックJavaScript

アイソモーフィックJavaScript

Jason Strimpel, Maxime Najim, 牧野 聡
データサイエンス講義

データサイエンス講義

Rachel Schutt, Cathy O'Neil, 瀬戸山 雅人, 石井 弓美子, 河内 崇, 河内 真理子, 古畠 敦, 木下 哲也, 竹田 正和, 佐藤 正士, 望月 啓充
プログラミングRust

プログラミングRust

Jim Blandy, Jason Orendorff, 中田 秀基

Publisher Resources

ISBN: 9784873117935Other