Home > Backend Development > PHP Tutorial > Examples of PHP object conversion to array and array conversion to object (picture and text)

Examples of PHP object conversion to array and array conversion to object (picture and text)

WBOY
Release: 2016-07-25 09:04:25
Original
873 people have browsed it
  1. /**bbs.it-home.org*/
  2. $array = array('1' => 'one',
  3. '2' => 'two',
  4. '3' => 'three');
  5. $arrayobject = new ArrayObject($array);
  6. var_dump($arrayobject);
  7. $array = array('1' => 'one',
  8. '2' => 'two',
  9. '3' => 'three');
  10. $arrayobject = new ArrayObject($array);
  11. var_dump($arrayobject);
  12. ?>
复制代码

输出结果: object(ArrayObject)#1 (3) { [1]=> string(3) "one" [2]=> string(3) "two" [3]=> string(5) "three" }



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template