File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array / array_splice_variation4.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test array_splice() function : usage variations - non array replacement values
--FILE--
<?php
/* 
 * proto array array_splice(array input, int offset [, int length [, array replacement]])
 * Function is implemented in ext/standard/array.c
*/ 

function test_splice ($replacement)
{
	$input_array=array(0,1);
	var_dump (array_splice ($input_array,2,0,$replacement));
	var_dump ($input_array);
}

test_splice (2);

test_splice (2.1);

test_splice (true);
//file type resource
$file_handle = fopen(__FILE__, "r");

test_splice ($file_handle);
echo "Done\n";
?>
--EXPECTF--
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  float(2.1)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  bool(true)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  resource(%d) of type (stream)
}
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>