each

Each,英文單詞,意為“每一個”。

程式函式PHP 3, PHP 4, PHP 5中,each()作用是返回數組中當前的鍵/值對並將數組指針向前移動一步。

基本介紹

  • 中文名:每;每一個
  • 外文名:each
  • 屬性:英文單詞;程式函式
程式函式,說明,注意,英文單詞,區別,Each用法,例子,注意,

程式函式

each()
(PHP 3, PHP 4, PHP 5)
each() -- 返回數組中當前的鍵/值對並將數組指針向前移動一步

說明

array each ( array &array )
返回 array 數組中當前指針位置的鍵/值對並向前移動數組指針。鍵值對被返回為四個單元的數組,鍵名為 0,1,key 和 value。單元 0 和 key 包含有數組單元的鍵名,1 和 value 包含有數據。
如果內部指針越過了數組的末端,則 each() 返回 FALSE。
在執行 each() 之後,數組指針將停留在數組中的下一個單元或者當碰到數組結尾時停留在最後一個

注意

因為將一個數組賦值給另一個數組時會重置原來的數組指針,因此在上邊的例子中如果我們在循環內部將 fruit 賦給了另一個變數的話將會導致無限循環

英文單詞

each是一個英文單詞,英音為 [i:tʃ],美音 [itʃ]。意思是“每個”,詞性有形容詞副詞代詞三種,常用動詞單數形式,多用於兩個或兩個以上的人或物。
each and all 每人都;個個;全部
each and every 每個
each other 互相:彼此

區別

each表示一定數目中的“每一個”,“個別”意義較重,表示“各有不同”,更強調個體;eg:
Each one has his weakness.
每人都有每人的缺點。
every表示數目不確定的許多人或物中間的“每一個”,“總和”意義較重,更強調總體,表示“大家一致”;eg:
Everyone is here.
大家都到了。

Each用法

一、each作“各自的”,“每個的”解,作形容詞用:
1.There are many trees on each side of the river.河流兩岸許多樹。
2.Each element has some special properties.每種元素都有些特殊性質。
二、作“各自”、“每個”講,作代詞用:
1.Each has his advantages.各人都有其優點。
2.He gave each of us a tool.他給我們每人一件工具。
三、作“各自地”講,作副詞用:
1.Give them two books each.(=Give each of them two books.)給他們每個人兩本書。
2.The students have ten books each.(=Each of the students has ten books.)這些學生每人有十本書。
3.Different kinds of waves have each the same three characteristics: amplitude, frequency and length.不同的波(各)都有三個相同的特性:幅度、頻率和波長。
四、注意each作同位語的用法:
1.They each put forward a proposal.他們每人提出一條建議。
2.The workers are each of them hard-working.這些工人個個勤奮勞動。
五、each other作“互相”、“彼此”解:
1.We help each other.我們互相幫助。
2.They speak English to each other.他們彼此講英語。
3.We often compare notes with each other on our work and study.我們經常就工作和學習方面互相交換意見。
六、each和every詞義辨異:
Ⅰ.every只能作形容詞,只有在與名詞連用或構成複合詞(如everybody每個人)時,才能作主語或賓語等,而each還可以作代詞,直接作主語或賓語(見本文二各例句)。
Ⅱ.every雖指每個,而概括全體,而each只是指“每個”,卻以“各……”為主。例如:
1.I know every member of the class.全班的人我都認識。(著重全體,即雖指每個,而概括全體。)
2.I know each member of the class.這個班每個人我都認識。(“個別”意義較重。)
3.We must correct every single error.我們必須改正所有錯誤。(著重全體。)
4.They each have a tool.他們每人有一件工具。(“個別”意義較重。)
5.Hydrogen and sodium each have one electron in the outer layer. Each has a combining power of one. They each have one electron to lend to anther atom.氫和鈉在外層各有一個電子。它們的化合價都是1.它們各有一個電子可借給其他原子。(句中第一、三個each作同位語,第二個each為代詞作主語。這三個each都是“個別”意義較重。句中第二個one是通過of引出的同位語。)

例子

  • He pricked down each item.
    她記下了每一項。
  • Try todressappropriatelyforeachoccasion.
    試圖為每個場合適當地打扮。
  • Theyreviewedeachaspectoftheplanbit by bit.
    他們對計畫的各個方面逐一地進行了審核。
  • Theycut thecakeintwoandatehalfeach.
    他們把蛋糕分成兩塊,每人吃半塊。
  • Eachhas bothadvantagesanddisadvantages.
    各有優點,也各有缺點。
  • They weremadeforeachother.
    他們是合適的一對。
  • Theyloveeachother despite theirfrequent quarrels.
    吵架歸吵架, 可他倆還是很相愛。
  • At thebeginningofeachclass,Icountoff thestudents.
    每節課開始我先數一下學生的人數。
  • Theaccountingofficechecked offeachworker'sduesevery month.
    會計部門每月扣除每個工人的應繳費用。
  • Hismainworkistoreceiptforeachlot ofgoods.
    他的主要工作是給每一批貨物開收據。

注意

1、each和every後的動詞必須是單數
2、each可作主語、同位語、定語和狀語,而every只能作定語。

相關詞條

熱門詞條

聯絡我們