0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【PHP】配列を文字列(EDI情報)化

Posted at

#はじめに
EDI情報作成時に使ったロジックなので備忘録として残します。

#サンプルコード

class TestA
{
	public function __construct()
	{
	    $this->test1 = "00";
	    $this->test2 = "          ";
	    $this->test3 = "00";
	    $this->test4 = "          ";
	    $this->test5 = "GG";
	}
	public function getTest1()
  {
      return $this->test1;
  }
  public function setTest1($test1)
  {
      $this->test1 = $$test1;

      return $this;
  }
	・・・(省略)
}


class TestB
{
	$test;
	
	public function build()
	{
		$this->setTest(new TestA());
		$test = $this->getTest();
		
		$testMessage = 'AAA'.'|'.
		$test->getTest1().'|'.
		$test->getTest2().'|'.
		$test->getTest3().'|'.
		$test->getTest4().'|'.
		$test->getTest5();
		var_dump($testMessage);
	}

	public function getTest()
	{
		return $this->test;
	}
	
	public function setTest()
	{
		$this->test = $test;
		
		return $test;
}

#var_dumpの結果

"AAA|00|          |00|          |GG"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?